qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>, Alex Bligh <alex@alex.org.uk>
Cc: "nbd-general@lists.sourceforge.net"
	<nbd-general@lists.sourceforge.net>,
	Kevin Wolf <kwolf@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Pavel Borzenkov <pborzenkov@virtuozzo.com>,
	"Stefan stefanha@redhat. com" <stefanha@redhat.com>,
	Wouter Verhelst <w@uter.be>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [Nbd] [PATCH v2] doc: Add NBD_CMD_BLOCK_STATUS extension
Date: Mon, 4 Apr 2016 14:34:26 -0600	[thread overview]
Message-ID: <5702CFD2.9070402@redhat.com> (raw)
In-Reply-To: <5702C9BE.8050307@openvz.org>

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

On 04/04/2016 02:08 PM, Denis V. Lunev wrote:
>>
>> This again makes me think this should be a different
>> command from something which is obviously useful and
>> comprehensible to more than one server/client (i.e.
>> allocation).
>>
> original design of this command has used 16 number
> to specify the NUMBER of the bitmap which was
> exported by the server.

The original design abused the 16-bit 'flags' field of each command to
instead try and treat that value as a bitmap number, instead of a
bitwise-or'd set of flags.  That was one of the complaints against v1,
and was fixed in v2 by having a single boolean flag, NBD_CMD_FLAG_DIRTY,
which was off for (default) allocation queries, and set for dirtiness
queries.  We can add other flags for any other type of queries, and the
principle of each query being a run-length-encoded listing still applies.

> 
> We have reserved number 0 for 'used' bitmap, i.e.
> bitmap of allocated blocks and number 1 for 'dirty'
> bitmap. Though we can skip specification of the
> belonging of any number except '0' and put them
> to server-client negotiations. Or we could reserve
> '1' for dirtiness state as server-client agrees and
> allow other applications to register their own bitmaps
> as the deserve to.
> 
> Why not to do things this original way?

If you want to encode particular ids, you should do so in a separate
field, and not overload the 'flags' field.

As it is, we don't have structured writes - right now, you can write a
wire sniffer for the client side, where all commands except
NBD_CMD_WRITE are fixed size, and NBD_CMD_WRITE describes its own size
via its length field; the extension NBD_CMD_WRITE_ZEROES still fits into
this scheme.  All NBD implementations have to supply NBD_CMD_WRITE, but
any extension commands do NOT have to be universal.  Writing a wire
sniffer that special-cases NBD_CMD_WRITE is easy (since that command
will always exist), but writing a wire sniffer that special-cases
arbitrary commands, particularly where those arbitrary commands do not
also self-describe the length of the command, is hard.  We can't
overload the flags field to say which bitmap id to grab, but we also
can't arbitrarily add 4 bytes to the command size when the command is
NBD_CMD_BLOCK_STATUS (because wire sniffers that don't know about
NBD_CMD_BLOCK_STATUS wouldn't know to expect those four bytes to be part
of the current packet rather than starting a new packet).

The recent work on structured reads made it possible for an arbitrary
wire sniffer to gracefully skip over the variable-length return size
reply to NBD_CMD_BLOCK_STATUS, and any other extension command that we
might add later.  But right now, I'm not seeing a compelling reason to
add structured commands to the NBD protocol.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-04-04 20:34 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 16:39 [Qemu-devel] [PATCH v2] doc: Add NBD_CMD_BLOCK_STATUS extension Eric Blake
2016-04-04 18:06 ` [Qemu-devel] [Nbd] " Alex Bligh
2016-04-04 19:34   ` Eric Blake
2016-04-04 19:54     ` Denis V. Lunev
2016-04-04 20:03       ` Alex Bligh
2016-04-04 20:08         ` Denis V. Lunev
2016-04-04 20:34           ` Eric Blake [this message]
2016-04-04 21:06             ` Denis V. Lunev
2016-04-04 21:12             ` Alex Bligh
2016-04-05 14:15         ` Paolo Bonzini
2016-04-05 15:01           ` Alex Bligh
2016-04-05 15:23             ` Paolo Bonzini
2016-04-05 15:27               ` Alex Bligh
2016-04-05 15:31                 ` Paolo Bonzini
2016-04-04 23:08       ` Wouter Verhelst
2016-04-04 23:32         ` Eric Blake
2016-04-05  7:16           ` Wouter Verhelst
2016-04-05 21:44           ` Wouter Verhelst
2016-04-05  7:13         ` Alex Bligh
2016-04-04 19:58     ` Alex Bligh
2016-04-04 20:04       ` Denis V. Lunev
2016-04-04 20:08         ` Alex Bligh
2016-04-04 20:13           ` Denis V. Lunev
2016-04-04 20:15             ` Alex Bligh
2016-04-04 20:27               ` Denis V. Lunev
2016-04-04 20:45                 ` Eric Blake
2016-04-04 21:04                   ` Denis V. Lunev
2016-04-04 21:12                     ` Alex Bligh
2016-04-04 21:17                     ` Eric Blake
2016-04-04 21:27                       ` Denis V. Lunev
2016-04-04 20:26           ` Eric Blake
2016-04-04 21:07             ` Alex Bligh
2016-04-04 21:25               ` Eric Blake
2016-04-04 22:06                 ` Alex Bligh
2016-04-04 20:22       ` Eric Blake
2016-04-05 13:38     ` Paolo Bonzini
2016-04-04 22:40 ` Wouter Verhelst
2016-04-04 23:03   ` Eric Blake
2016-04-05 13:41     ` Paolo Bonzini
2016-04-06  5:57     ` Denis V. Lunev
2016-04-06 14:08       ` Eric Blake
2016-04-05  4:05 ` [Qemu-devel] " Kevin Wolf
2016-04-05 13:43   ` Paolo Bonzini
2016-04-07 10:38     ` Vladimir Sementsov-Ogievskiy
2016-04-07 16:10       ` Eric Blake
2016-04-07 16:21         ` [Qemu-devel] [Nbd] " Alex Bligh
2016-04-08 11:35         ` [Qemu-devel] " Kevin Wolf
2016-04-09  9:08         ` [Qemu-devel] [Nbd] " Wouter Verhelst
2016-04-13 12:38         ` [Qemu-devel] " Pavel Borzenkov
2016-04-13 14:40           ` Eric Blake
2016-04-07 15:35     ` Pavel Borzenkov
2016-04-07 15:43       ` Paolo Bonzini
2016-04-05  8:51 ` Stefan Hajnoczi
2016-04-05  9:24 ` [Qemu-devel] [Nbd] " Markus Pargmann
2016-04-05 13:50   ` Paolo Bonzini
2016-04-11  5:58     ` Markus Pargmann
2016-04-05 14:14   ` Eric Blake
2016-04-05 20:50     ` Wouter Verhelst
2016-04-11  6:07       ` Markus Pargmann

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=5702CFD2.9070402@redhat.com \
    --to=eblake@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=nbd-general@lists.sourceforge.net \
    --cc=pbonzini@redhat.com \
    --cc=pborzenkov@virtuozzo.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=w@uter.be \
    /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).