All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Alberto Garcia <berto@igalia.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com,
	mreitz@redhat.com, kwolf@redhat.com, eblake@redhat.com,
	den@openvz.org
Subject: Re: [PATCH v6 2/5] block/io: bdrv_common_block_status_above: support include_base
Date: Wed, 23 Sep 2020 20:11:57 +0300	[thread overview]
Message-ID: <6181089a-8910-442e-35ed-e1bca0bde3eb@virtuozzo.com> (raw)
In-Reply-To: <w51tuvoa2l8.fsf@maestria.local.igalia.com>

23.09.2020 19:18, Alberto Garcia wrote:
> On Wed 16 Sep 2020 02:20:05 PM CEST, Vladimir Sementsov-Ogievskiy wrote:
>> -    for (p = backing_bs(bs); p != base; p = backing_bs(p)) {
>> +    for (p = backing_bs(bs); include_base || p != base; p = backing_bs(p)) {
>>           ret = bdrv_co_block_status(p, want_zero, offset, bytes, pnum, map,
>>                                      file);
>>           if (ret < 0) {
>> @@ -2420,6 +2422,11 @@ bdrv_co_common_block_status_above(BlockDriverState *bs,
>>               break;
>>           }
>>   
>> +        if (p == base) {
>> +            assert(include_base);
>> +            break;
>> +        }
>> +
> 
> Another option is something like:
> 
>     BlockDriverState *last_bs = include_base ? base : backing_bs(base);

hmm, in case when include_base is false, last bs is not backing_bs(base) but the parent of base.

> 
> and you get a simpler 'for' loop.
> 
> But why do we need include_base at all? Can't the caller just pass
> backing_bs(base) instead? I'm talking also about the existing case of
> bdrv_is_allocated_above().
> 


include_base was introduced for the case when caller doesn't own backing_bs(base), and therefore shouldn't do operations that may yield (block_status can) dependent on backing_bs(base). In particular, in block stream, where link to base is not frozen.


-- 
Best regards,
Vladimir


  reply	other threads:[~2020-09-23 17:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 12:20 [PATCH v6 0/5] fix & merge block_status_above and is_allocated_above Vladimir Sementsov-Ogievskiy
2020-09-16 12:20 ` [PATCH v6 1/5] block/io: fix bdrv_co_block_status_above Vladimir Sementsov-Ogievskiy
2020-09-24 16:20   ` Alberto Garcia
2020-09-16 12:20 ` [PATCH v6 2/5] block/io: bdrv_common_block_status_above: support include_base Vladimir Sementsov-Ogievskiy
2020-09-23 16:18   ` Alberto Garcia
2020-09-23 17:11     ` Vladimir Sementsov-Ogievskiy [this message]
2020-09-23 17:47       ` Alberto Garcia
2020-09-23 17:49   ` Alberto Garcia
2020-09-16 12:20 ` [PATCH v6 3/5] block/io: bdrv_common_block_status_above: support bs == base Vladimir Sementsov-Ogievskiy
2020-09-23 16:22   ` Alberto Garcia
2020-09-16 12:20 ` [PATCH v6 4/5] block/io: fix bdrv_is_allocated_above Vladimir Sementsov-Ogievskiy
2020-09-24 16:21   ` Alberto Garcia
2020-09-16 12:20 ` [PATCH v6 5/5] iotests: add commit top->base cases to 274 Vladimir Sementsov-Ogievskiy
2020-09-24 16:24   ` Alberto Garcia

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=6181089a-8910-442e-35ed-e1bca0bde3eb@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=berto@igalia.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.