qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/5] block-copy: streamline choice of copy_range vs. read/


From: Paolo Bonzini
Subject: Re: [PATCH v3 1/5] block-copy: streamline choice of copy_range vs. read/write
Date: Wed, 9 Jun 2021 11:33:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]