From: Paolo Bonzini <pbonzini@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Emanuele Giuseppe Esposito <eesposit@redhat.com>,
qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
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 [thread overview]
Message-ID: <8f49c449-583b-8842-9920-dd0dc1196e1f@redhat.com> (raw)
In-Reply-To: <ddc23736-d6ce-cdde-21b8-f809ef65ea65@virtuozzo.com>
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
next prev parent reply other threads:[~2021-06-09 9:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 7:33 [PATCH v3 0/5] block-copy: protect block-copy internal structures Emanuele Giuseppe Esposito
2021-06-08 7:33 ` [PATCH v3 1/5] block-copy: streamline choice of copy_range vs. read/write Emanuele Giuseppe Esposito
2021-06-09 8:51 ` Vladimir Sementsov-Ogievskiy
2021-06-09 9:33 ` Paolo Bonzini [this message]
2021-06-09 10:09 ` Vladimir Sementsov-Ogievskiy
2021-06-09 10:54 ` Vladimir Sementsov-Ogievskiy
2021-06-08 7:33 ` [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions Emanuele Giuseppe Esposito
2021-06-09 9:12 ` Vladimir Sementsov-Ogievskiy
2021-06-10 10:14 ` Emanuele Giuseppe Esposito
2021-06-10 10:27 ` Vladimir Sementsov-Ogievskiy
2021-06-10 10:46 ` Emanuele Giuseppe Esposito
2021-06-10 11:12 ` Vladimir Sementsov-Ogievskiy
2021-06-10 14:21 ` Emanuele Giuseppe Esposito
2021-06-10 15:05 ` Vladimir Sementsov-Ogievskiy
2021-06-08 7:33 ` [PATCH v3 3/5] block-copy: move progress_set_remaining in block_copy_task_end Emanuele Giuseppe Esposito
2021-06-08 7:33 ` [PATCH v3 4/5] block-copy: add a CoMutex Emanuele Giuseppe Esposito
2021-06-09 12:25 ` Vladimir Sementsov-Ogievskiy
2021-06-10 14:49 ` Emanuele Giuseppe Esposito
2021-06-08 7:33 ` [PATCH v3 5/5] block-copy: atomic .cancelled and .finished fields in BlockCopyCallState Emanuele Giuseppe Esposito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f49c449-583b-8842-9920-dd0dc1196e1f@redhat.com \
--to=pbonzini@redhat.com \
--cc=eesposit@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).