qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	pkrempa@redhat.com, qemu-block@nongnu.org,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	vsementsov@virtuozzo.com
Subject: Re: [PATCH 2/3] nbd: Add new qemu:allocation-depth metacontext
Date: Mon, 28 Sep 2020 09:33:22 -0500	[thread overview]
Message-ID: <d0290138-f9d9-86a1-faf7-34f3ef4218c2@redhat.com> (raw)
In-Reply-To: <20200926073308.GV3888@redhat.com>

On 9/26/20 2:33 AM, Richard W.M. Jones wrote:
> On Fri, Sep 25, 2020 at 03:32:48PM -0500, Eric Blake wrote:
>> +The second is related to exposing the source of various extents within
>> +the image, with a single context named:
>> +
>> +    qemu:allocation-depth
>> +
>> +In the allocation depth context, bits 0 and 1 form a tri-state value:
>> +
>> +    bits 0-1 clear: NBD_STATE_DEPTH_UNALLOC, means the extent is unallocated
>> +    bit 0 set: NBD_STATE_DEPTH_LOCAL, the extent is allocated in this image
>> +    bit 1 set: NBD_STATE_DEPTH_BACKING, the extent is inherited from a
>> +               backing layer
> 
>>From the cover description I imagined it would show the actual depth, ie:
> 
>           top -> backing -> backing -> backing
>   depth:   1        2         3   ....          (0 = unallocated)
> 
> I wonder if that is possible?  (Perhaps there's something I don't
> understand here.)

The real reason I don't want to do a straight depth number is that 
'qemu-img map' combined with x-dirty-bitmap is still a very convenient 
way to get at bits 0 and 1 (even if it requires decoding).  But if we 
plumb in a way for bdrv_get_status to return depth counts (rather than 
reimplementing the depth count ourselves), I would have no problem with 
returning a struct:

bits 31-4: the depth of the chain
bits 3-2: reserved (to make reading hex values easier...)
bits 1-0: tri-state of unalloc, local, or backing

where it would look like:

0x0000 -> unallocated
0x0011 -> depth 1, local
0x0022 -> depth 2, from the first backing layer
0x0032 -> depth 3, from the second backing layer
0x0042 ...

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  parent reply	other threads:[~2020-09-28 14:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 20:32 [PATCH 0/3] Exposing backing-chain allocation over NBD Eric Blake
2020-09-25 20:32 ` [PATCH 1/3] nbd: Simplify meta-context parsing Eric Blake
2020-09-26 12:58   ` Vladimir Sementsov-Ogievskiy
2020-09-28 14:05     ` Eric Blake
2020-09-25 20:32 ` [PATCH 2/3] nbd: Add new qemu:allocation-depth metacontext Eric Blake
2020-09-26  7:33   ` Richard W.M. Jones
2020-09-26 13:19     ` Vladimir Sementsov-Ogievskiy
2020-09-28 14:33     ` Eric Blake [this message]
2020-09-28 16:17       ` Richard W.M. Jones
2020-09-26 13:15   ` Vladimir Sementsov-Ogievskiy
2020-09-25 20:32 ` [PATCH 3/3] nbd: Add 'qemu-nbd -A' to expose allocation depth Eric Blake
2020-09-26  7:34   ` Richard W.M. Jones
2020-09-26 13:32   ` Vladimir Sementsov-Ogievskiy
2020-09-28 14:35     ` 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=d0290138-f9d9-86a1-faf7-34f3ef4218c2@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@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 NNTP newsgroup(s).