[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] proto: add 'shift' extension.

From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH] proto: add 'shift' extension.
Date: Mon, 26 Sep 2016 16:53:35 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 26.09.2016 15:51, Paolo Bonzini wrote:

On 26/09/2016 14:46, Vladimir Sementsov-Ogievskiy wrote:
This extension allows big requests for TRIM and WRITE_ZEROES through
special 'shift' parameter, which means that offset and length should be
shifted left by several bits.

This is needed for efficient clearing large regions of the disk (up to
the whole disk).

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>

Here mentioned WRITE_ZEROES command which is only an experemental
extension for now.

To dicuss:
NBD_OPT_SHIFT Data. It can be reduced to 8 bits actually... Are some
    reserved bits needed here?

  doc/proto.md | 19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/proto.md b/doc/proto.md
index 2de3a6a..6fd1b16 100644
--- a/doc/proto.md
+++ b/doc/proto.md
@@ -682,6 +682,8 @@ The field has the following format:
    experimental `WRITE_ZEROES` 
  - bit 7, `NBD_FLAG_SEND_DF`: defined by the experimental `STRUCTURED_REPLY`
+- bit 8, `NBD_FLAG_SEND_SHIFT` : exposes support for `NBD_CMD_FLAG_SHIFT` and
Clients SHOULD ignore unknown flags. @@ -765,6 +767,15 @@ of the newstyle negotiation. Defined by the experimental `INFO` [extension](https://github.com/yoe/nbd/blob/extension-info/doc/proto.md). +- `NBD_OPT_SHIFT` (10)
+    Defines shift used to calculate request offset and length if
+    `NBD_CMD_FLAG_SHIFT` is set.
+    Data:
+    - 32 bits, shift (unsigned); Must not be larger than 32.
  #### Option reply types
These values are used in the "reply type" field, sent by the server
@@ -872,7 +883,13 @@ valid may depend on negotiation during the handshake phase.
  - bit 2, `NBD_CMD_FLAG_DF`; defined by the experimental `STRUCTURED_REPLY`
+- bit 3, `NBD_CMD_FLAG_SHIFT`; This flag is valid for `NBD_CMD_TRIM` and
+  `NBD_CMD_WRITE_ZEROES`. If this flag is set the server shifts request
+  *length* and *offset* left by N bits, where N is defined by `NBD_OPT_SHIFT`
+  option or is assumed to be 16 bits by default if `NBD_OPT_SHIFT` option is
+  not specified. If after shift `(offset + length)` exceeds disk size, length
+  should be reduced to `(<disk size> - offset)`. However, `(offset + length)`
+  must not exceed disk size by more than `(1 << N) - 1`.
#### Request types
This is very ad hoc.  Can we instead have a block size common to all
commands?  Block devices in practice have one, in fact that's why
they're called block devices...


Block size can be too small to clear the whole disk in one request (i.e. (2**31 * block_size) is too small..)

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]