From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: jsnow@redhat.com, qemu-block@nongnu.org,
Paolo Bonzini <pbonzini@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/2] nbd/client: Add x-dirty-bitmap to query bitmap from server
Date: Tue, 3 Jul 2018 11:13:32 -0500 [thread overview]
Message-ID: <e2d6605a-bc73-941c-67d7-b28da34ca48d@redhat.com> (raw)
In-Reply-To: <79924948-36a8-e604-22c3-d7e407c84e30@virtuozzo.com>
On 07/03/2018 04:46 AM, Vladimir Sementsov-Ogievskiy wrote:
>> #
>> +# @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in
>> place of
>> +# traditional "base:allocation" block status (see
>> +# NBD_OPT_LIST_META_CONTEXT in the NBD protocol)
>> (since 3.0)
>> +#
>
> "x-dirty-bitmap=qemu:dirty-bitmap:NAME", is a bit strange, looks like it
> should be "x-dirty-bitmap=NAME", and "qemu:dirty-bitmap" added
> automatically. (and you don't check it, so actually this parameter is
> x-meta-context, and user can select any context, for example,
> "base:allocation", so "x-meta-context=qemu:dirty-bitmap:NAME" sounds
> better too). But I'm ok to leave it as is for now, with x- prefix.
Good point on 'x-meta-context' being slightly nicer; but bikeshedding an
experimental name doesn't really impact the release.
For 3.1, I'd love to have:
qemu-img map --output=json --image-opts driver=nbd,...,bitmap=FOO
automatically connect to qemu:dirty-bitmap:FOO in addition to block
status, resulting in output for iotest 223 that resembles:
[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false},
{ "start": 1048576, "length": 1048576, "depth": 0, "zero": false,
"data": true},
{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false,
"data": true, "dirty": true}]
(that is, an optional 'dirty' member added to the JSON to identify the
dirty portions, in addition to everything else already identified). I
also want to enhance that test to show that discarding clusters works
during dirty tracking (that is, a "data":false, "dirty":true entry
should be demonstrated).
Getting to that point will mean adding a new BDRV_BLOCK_DIRTY bit to the
output of bdrv_block_status() (even if only the NBD and passthrough
drivers set it), as well as teaching qemu-img map to optionally honor
that bit when present. It also means the NBD client code will be
subscribing to status from two meta contexts at once, with the second
being exactly a qemu:dirty-bitmap (rather than a free-for-all string
that x-dirty-bitmap currently gives us).
It's too late to get these improvements into 3.0, but should be a good
path forward in the next few months.
>> @@ -982,9 +983,11 @@ int nbd_client_init(BlockDriverState *bs,
>> client->info.request_sizes = true;
>> client->info.structured_reply = true;
>> client->info.base_allocation = true;
>> + client->info.x_dirty_bitmap = g_strdup(x_dirty_bitmap);
>> ret = nbd_receive_negotiate(QIO_CHANNEL(sioc), export,
>> tlscreds, hostname,
>> &client->ioc, &client->info, errp);
>> + g_free(client->info.x_dirty_bitmap);
>
> hm, pointer remains invalid. If you want free it here, what is the
> reason to strdup it? At least, it worth to zero out the pointer after
> g_free.. Or, free it not here but in client close.
The g_strdup() is necessary since client.x_dirty_bitmap is 'const char
*'. Nothing used the pointer after it is freed, although I could agree
that assigning it to NULL to make that point obvious wouldn't hurt;
however, the pull request was already taken as-is, so we can just live
with it until the 3.1 improvements.
>
> with pointer zeroed or g_free to client destroy procedure,
>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-07-03 16:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 19:14 [Qemu-devel] [PATCH v2 0/2] test NBD bitmap export Eric Blake
2018-07-02 19:14 ` [Qemu-devel] [PATCH v2 1/2] nbd/client: Add x-dirty-bitmap to query bitmap from server Eric Blake
2018-07-03 9:46 ` Vladimir Sementsov-Ogievskiy
2018-07-03 16:13 ` Eric Blake [this message]
2018-07-02 19:14 ` [Qemu-devel] [PATCH v2 2/2] iotests: New test 223 for exporting dirty bitmap over NBD Eric Blake
2018-07-02 21:27 ` John Snow
2018-07-03 0:42 ` Eric Blake
2018-07-03 10:29 ` Vladimir Sementsov-Ogievskiy
2018-07-03 10:09 ` Vladimir Sementsov-Ogievskiy
2018-07-03 16:17 ` Eric Blake
2018-07-02 20:39 ` [Qemu-devel] [PATCH v2 0/2] test NBD bitmap export 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=e2d6605a-bc73-941c-67d7-b28da34ca48d@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@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).