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: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	Alberto Garcia <berto@igalia.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	QEMU <qemu-devel@nongnu.org>, Max Reitz <mreitz@redhat.com>,
	"nbd@other.debian.org" <nbd@other.debian.org>,
	"libguestfs@redhat.com" <libguestfs@redhat.com>
Subject: Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
Date: Tue, 11 Feb 2020 08:33:26 -0600	[thread overview]
Message-ID: <6ac74a99-67b6-3c41-873f-174237412605@redhat.com> (raw)
In-Reply-To: <20200210225255.GJ3888@redhat.com>

On 2/10/20 4:52 PM, Richard W.M. Jones wrote:
> On Mon, Feb 10, 2020 at 04:29:53PM -0600, Eric Blake wrote:
>> On 2/10/20 4:12 PM, Richard W.M. Jones wrote:
>>> On Mon, Feb 10, 2020 at 03:37:20PM -0600, Eric Blake wrote:
>>>> For now, only 2 of those 16 bits are defined: NBD_INIT_SPARSE (the
>>>> image has at least one hole) and NBD_INIT_ZERO (the image reads
>>>> completely as zero); the two bits are orthogonal and can be set
>>>> independently, although it is easy enough to see completely sparse
>>>> files with both bits set.
>>>
>>> I think I'm confused about the exact meaning of NBD_INIT_SPARSE.  Do
>>> you really mean the whole image is sparse; or (as you seem to have
>>> said above) that there exists a hole somewhere in the image but we're
>>> not saying where it is and there can be non-sparse parts of the image?
>>
>> As implemented:
>>
>> NBD_INIT_SPARSE - there is at least one hole somewhere (allocation
>> would be required to write to that part of the file), but there may
>> b allocated data elsewhere in the image.  Most disk images will fit
>> this definition (for example, it is very common to have a hole
>> between the MBR or GPT and the first partition containing a file
>> system, or for file systems themselves to be sparse within the
>> larger block device).
> 
> I think I'm still confused about why this particular flag would be
> useful for clients (I can completely understand why clients need
> NBD_INIT_ZERO).
> 
> But anyway ... could a flag indicating that the whole image is sparse
> be useful, either as well as NBD_INIT_SPARSE or instead of it?  You
> could use it to avoid an initial disk trim, which is something that
> mke2fs does:
> 
>    https://github.com/tytso/e2fsprogs/blob/0670fc20df4a4bbbeb0edb30d82628ea30a80598/misc/mke2fs.c#L2768

I'm open to suggestions on how many initial bits should be provided.  In 
fact, if we wanted, we could have a pair mutually-exclusive bits, 
advertising:
00 - no information known
01 - image is completely sparse
10 - image is completely allocated
11 - error

The goal of providing a 16-bit answer (or we could mandate 32 or 64 
bits, if we think we will ever want to extend that far) was to make it 
easier to add in whatever other initial-state extensions that someone 
could find useful.  Until we're happy with the design, the size or any 
given bit assignment is not locked down; once we do start committing any 
of this series, we've locked in what interoperability will demand but 
still have spare bits as future extensions.

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



  reply	other threads:[~2020-02-11 14:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 21:37 Cross-project NBD extension proposal: NBD_INFO_INIT_STATE Eric Blake
2020-02-10 21:41 ` [qemu PATCH 0/3] NBD_INFO_INIT_STATE extension Eric Blake
2020-02-10 21:41   ` [PATCH 1/3] nbd: Preparation for NBD_INFO_INIT_STATE Eric Blake
2020-02-10 21:41   ` [PATCH 2/3] nbd: Add .bdrv_known_zeroes() client support Eric Blake
2020-02-10 21:41   ` [PATCH 3/3] nbd: Add .bdrv_known_zeroes() server support Eric Blake
2020-02-10 21:51   ` [qemu PATCH 0/3] NBD_INFO_INIT_STATE extension no-reply
2020-02-10 21:54     ` Eric Blake
2020-02-10 21:53   ` no-reply
2020-02-10 22:12 ` Cross-project NBD extension proposal: NBD_INFO_INIT_STATE Richard W.M. Jones
2020-02-10 22:29   ` Eric Blake
2020-02-10 22:52     ` Richard W.M. Jones
2020-02-11 14:33       ` Eric Blake [this message]
2020-02-12  7:27       ` Wouter Verhelst
2020-02-12 12:09         ` Eric Blake
2020-02-12 12:36           ` Richard W.M. Jones
2020-02-12 12:47             ` Eric Blake
2020-02-17 15:13 ` Max Reitz
2020-02-18 20:55   ` Eric Blake
2020-02-19 11:10     ` Max Reitz

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=6ac74a99-67b6-3c41-873f-174237412605@redhat.com \
    --to=eblake@redhat.com \
    --cc=berto@igalia.com \
    --cc=libguestfs@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=nbd@other.debian.org \
    --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).