On 09/06/21 10:51, Vladimir Sementsov-Ogievskiy wrote:
+ default:
[...]
+ bounce_buffer = qemu_blockalign(s->source->bs, nbytes);
+ ret = bdrv_co_pread(s->source, offset, nbytes, bounce_buffer,
0);
+ if (ret < 0) {
+ trace_block_copy_read_fail(s, offset, ret);
+ *error_is_read = true;
+ goto out;
+ }
+ ret = bdrv_co_pwrite(s->target, offset, nbytes, bounce_buffer,
+ s->write_flags);
+ if (ret < 0) {
+ trace_block_copy_write_fail(s, offset, ret);
+ *error_is_read = false;
+ goto out;
+ }
+out:
+ qemu_vfree(bounce_buffer);
label inside switch operator? Rather unusual. Please, let's avoid it and
just keep out: after switch operator.
Agreed with all comments except this one, the bounce_buffer doesn't
exist in the other cases.
+ ret = block_copy_do_copy(s, t->offset, t->bytes, &method, &error_is_read);
+ if (s->method == t->method) {
+ s->method = method;
you leave another t->s occurrences in the function untouched. It's somehow inconsistent. Could we just use t->s in this patch, and refactor with a follow-up patch (or as preparing patch)?
Maybe as a first patch, yes.
Paolo