From: Max Reitz <mreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 4/5] block/block-copy: refactor task creation
Date: Wed, 29 Apr 2020 13:56:47 +0200 [thread overview]
Message-ID: <0f14b02d-884a-9581-f1c7-7133e6d36557@redhat.com> (raw)
In-Reply-To: <92dd552d-b181-5b39-c796-e228c4d33379@virtuozzo.com>
[-- Attachment #1.1: Type: text/plain, Size: 2838 bytes --]
On 29.04.20 13:54, Vladimir Sementsov-Ogievskiy wrote:
> 29.04.2020 14:38, Max Reitz wrote:
>> On 29.04.20 08:10, Vladimir Sementsov-Ogievskiy wrote:
>>> Instead of just relying on the comment "Called only on full-dirty
>>> region" in block_copy_task_create() let's move initial dirty area
>>> search directly to block_copy_task_create(). Let's also use effective
>>> bdrv_dirty_bitmap_next_dirty_area instead of looping through all
>>> non-dirty clusters.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> ---
>>> block/block-copy.c | 78 ++++++++++++++++++++++++++--------------------
>>> 1 file changed, 44 insertions(+), 34 deletions(-)
>>>
>>> diff --git a/block/block-copy.c b/block/block-copy.c
>>> index 35ff9cc3ef..5cf032c4d8 100644
>>> --- a/block/block-copy.c
>>> +++ b/block/block-copy.c
>>
>> [...]
>>
>>> @@ -106,17 +111,27 @@ static bool coroutine_fn
>>> block_copy_wait_one(BlockCopyState *s, int64_t offset,
>>> return true;
>>> }
>>> -/* Called only on full-dirty region */
>>> +/*
>>> + * Search for the first dirty area in offset/bytes range and create
>>> task at
>>> + * the beginning of it.
>>
>> Oh, that’s even better.
>>
>>> + */
>>> static BlockCopyTask *block_copy_task_create(BlockCopyState *s,
>>> int64_t offset,
>>> int64_t bytes)
>>> {
>>> - BlockCopyTask *task = g_new(BlockCopyTask, 1);
>>> + if (!bdrv_dirty_bitmap_next_dirty_area(s->copy_bitmap,
>>> + offset, offset + bytes,
>>> + s->copy_size, &offset,
>>> &bytes))
>>> + {
>>> + return NULL;
>>> + }
>>> + /* region is dirty, so no existent tasks possible in it */
>>> assert(!find_conflicting_task(s, offset, bytes));
>>> bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes);
>>> s->in_flight_bytes += bytes;
>>> + BlockCopyTask *task = g_new(BlockCopyTask, 1);
>>
>> This should be declared at the top of the function.
>>
>
> I just thought, why not to try another style? Are you against?
> Requirement to declare variables at start of block is obsolete, isn't it?
Oh, it absolutely is and personally I’m absolutely not against it, but
CODING_STYLE says:
> Mixed declarations (interleaving statements and declarations within
> blocks) are generally not allowed; declarations should be at the beginning
> of blocks.
Max
>> Reviewed-by: Max Reitz <mreitz@redhat.com>
>>
>>> *task = (BlockCopyTask) {
>>> .s = s,
>>> .offset = offset,
>>
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-04-29 12:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 6:10 [PATCH v3 0/5] block-copy: use aio-task-pool Vladimir Sementsov-Ogievskiy
2020-04-29 6:10 ` [PATCH v3 1/5] block/block-copy: rename in-flight requests to tasks Vladimir Sementsov-Ogievskiy
2020-04-29 10:57 ` Max Reitz
2020-04-29 6:10 ` [PATCH v3 2/5] block/block-copy: alloc task on each iteration Vladimir Sementsov-Ogievskiy
2020-04-29 6:10 ` [PATCH v3 3/5] block/block-copy: add state pointer to BlockCopyTask Vladimir Sementsov-Ogievskiy
2020-04-29 6:10 ` [PATCH v3 4/5] block/block-copy: refactor task creation Vladimir Sementsov-Ogievskiy
2020-04-29 11:38 ` Max Reitz
2020-04-29 11:54 ` Vladimir Sementsov-Ogievskiy
2020-04-29 11:56 ` Max Reitz [this message]
2020-04-29 12:04 ` Vladimir Sementsov-Ogievskiy
2020-04-29 6:10 ` [PATCH v3 5/5] block/block-copy: use aio-task-pool API Vladimir Sementsov-Ogievskiy
2020-04-29 11:55 ` Max Reitz
2020-04-29 12:11 ` Vladimir Sementsov-Ogievskiy
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=0f14b02d-884a-9581-f1c7-7133e6d36557@redhat.com \
--to=mreitz@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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 NNTP newsgroup(s).