qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com,
	hreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com,
	v.sementsov-og@ya.ru, yuriy.vasiliev@virtuozzo.com
Subject: Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair
Date: Mon, 21 Mar 2022 14:50:25 +0300	[thread overview]
Message-ID: <b55b3f46-6b8d-8522-9a08-e7c2ddcf8f67@mail.ru> (raw)
In-Reply-To: <20220316212855.ra54pckg3u6xgwzw@redhat.com>

17.03.2022 00:28, Eric Blake wrote:
> On Tue, Mar 15, 2022 at 12:32:25AM +0300, Vladimir Sementsov-Ogievskiy wrote:
>> From: Vladimir Sementsov-Ogievskiy <v.sementsov-og@ya.ru>
>>
>> Hi all! Current logic of relying on search through backing chain is not
>> safe neither convenient.
>>
>> Sometimes it leads to necessity of extra bitmap copying. Also, we are
>> going to add "snapshot-access" driver, to access some snapshot state
>> through NBD. And this driver is not formally a filter, and of course
>> it's not a COW format driver. So, searching through backing chain will
>> not work. Instead of widening the workaround of bitmap searching, let's
>> extend the interface so that user can select bitmap precisely.
>>
>> Note, that checking for bitmap active status is not copied to the new
>> API, I don't see a reason for it, user should understand the risks. And
>> anyway, bitmap from other node is unrelated to this export being
>> read-only or read-write.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@ya.ru>
>> ---
>>   blockdev-nbd.c         |  8 +++++-
>>   nbd/server.c           | 63 +++++++++++++++++++++++++++---------------
>>   qapi/block-export.json |  5 +++-
>>   qemu-nbd.c             | 11 ++++++--
>>   4 files changed, 61 insertions(+), 26 deletions(-)
>>
> 
>> @@ -1709,37 +1709,56 @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
>>       }
>>       exp->export_bitmaps = g_new0(BdrvDirtyBitmap *, exp->nr_export_bitmaps);
>>       for (i = 0, bitmaps = arg->bitmaps; bitmaps;
>> -         i++, bitmaps = bitmaps->next) {
>> -        const char *bitmap = bitmaps->value;
>> +         i++, bitmaps = bitmaps->next)
>> +    {
>> +        const char *bitmap;
> 
> I'm not sure if our prevailing style splits { to its own line on a
> multi-line 'for'.  But this is a cosmetic question, not one of
> correctness.
> 
>> +        case QTYPE_QDICT:
>> +            bitmap = bitmaps->value->u.external.name;
>> +            bm = block_dirty_bitmap_lookup(bitmaps->value->u.external.node,
>> +                                           bitmap, NULL, errp);
>> +            if (!bm) {
>> +                ret = -ENOENT;
>> +                goto fail;
>> +            }
>> +            break;
>> +        default:
>> +            abort();
> 
> Not sure if g_assert_not_reached() or __builtin_unreachable() would be
> any better here.  I'm fine with the abort() for now.
> 
>> +++ b/qapi/block-export.json
>> @@ -6,6 +6,7 @@
>>   ##
>>   
>>   { 'include': 'sockets.json' }
>> +{ 'include': 'block-core.json' }
> 
> Hmm.  Does this extra inclusion negatively impact qemu-storage-daemon,
> since that is why we created block-export.json in the first place (to
> minimize the stuff that qsd pulled in without needing all of
> block-core.json)?  In other words, would it be better to move
> BlockDirtyBitmapOrStr to this file?

And include block-export in block-core?

Another alternative is to move BlockDirtyBitmapOrStr to a separate file included from both block-export and block-core but that seems to be too much.

> 
> Everything else looks okay with this patch.
> 


-- 
Best regards,
Vladimir


  reply	other threads:[~2022-03-21 11:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 21:32 [PATCH v2 for-7.1 0/3] qapi: nbd-export: select bitmap by node/name pair Vladimir Sementsov-Ogievskiy
2022-03-14 21:32 ` [PATCH v2 1/3] qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr Vladimir Sementsov-Ogievskiy
2022-03-16 21:18   ` Eric Blake
2022-03-23  1:31     ` John Snow
2022-03-14 21:32 ` [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair Vladimir Sementsov-Ogievskiy
2022-03-16 21:28   ` Eric Blake
2022-03-21 11:50     ` Vladimir Sementsov-Ogievskiy [this message]
2022-03-21 13:30       ` Eric Blake
2022-04-08 20:27     ` Vladimir Sementsov-Ogievskiy
2022-04-22 20:04       ` Eric Blake
2022-03-14 21:32 ` [PATCH v2 3/3] iotests/223: check new possibility of exporting bitmaps by node/name Vladimir Sementsov-Ogievskiy
2022-03-16 22:01   ` Eric Blake
2022-03-14 21:45 ` [PATCH v2 for-7.1 0/3] qapi: nbd-export: select bitmap by node/name pair Vladimir Sementsov-Ogievskiy
2022-04-22 20:09   ` Eric Blake

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=b55b3f46-6b8d-8522-9a08-e7c2ddcf8f67@mail.ru \
    --to=v.sementsov-og@mail.ru \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=v.sementsov-og@ya.ru \
    --cc=yuriy.vasiliev@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).