From patchwork Mon Sep 26 12:46:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 675136 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sjP3R5dLWz9s5g for ; Mon, 26 Sep 2016 22:51:15 +1000 (AEST) Received: from localhost ([::1]:44186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVNJ-0004mk-RE for incoming@patchwork.ozlabs.org; Mon, 26 Sep 2016 08:51:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVJ0-00018X-JU for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:46:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boVIz-0000R2-Ep for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:46:46 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:14425 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVIt-0000OG-IZ; Mon, 26 Sep 2016 08:46:39 -0400 Received: from kvm.qa.sw.ru. ([10.28.8.145]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u8OCVfUE001971; Sat, 24 Sep 2016 15:31:42 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org, nbd-general@lists.sourceforge.net Date: Mon, 26 Sep 2016 15:46:21 +0300 Message-Id: <1474893981-5302-1-git-send-email-vsementsov@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH] proto: add 'shift' extension. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, alex@alex.org.uk, stefanha@redhat.com, w@uter.be, pbonzini@redhat.com, den@virtuozzo.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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` [extension](https://github.com/yoe/nbd/blob/extension-write-zeroes/doc/proto.md). - bit 7, `NBD_FLAG_SEND_DF`: defined by the experimental `STRUCTURED_REPLY` [extension](https://github.com/yoe/nbd/blob/extension-structured-reply/doc/proto.md). +- bit 8, `NBD_FLAG_SEND_SHIFT` : exposes support for `NBD_CMD_FLAG_SHIFT` and + `NBD_OPT_SHIFT` 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. [extension](https://github.com/yoe/nbd/blob/extension-write-zeroes/doc/proto.md). - bit 2, `NBD_CMD_FLAG_DF`; defined by the experimental `STRUCTURED_REPLY` [extension](https://github.com/yoe/nbd/blob/extension-structured-reply/doc/proto.md). - +- 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 `( - offset)`. However, `(offset + length)` + must not exceed disk size by more than `(1 << N) - 1`. #### Request types