From patchwork Wed Feb 17 18:10:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 8341911 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C002D9F372 for ; Wed, 17 Feb 2016 18:11:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 271AA202FE for ; Wed, 17 Feb 2016 18:11:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5C2E420272 for ; Wed, 17 Feb 2016 18:11:20 +0000 (UTC) Received: from localhost ([::1]:60328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW6ZL-0006jn-Mk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Feb 2016 13:11:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW6ZD-0006jV-HY for qemu-devel@nongnu.org; Wed, 17 Feb 2016 13:11:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW6ZA-0006tc-AL for qemu-devel@nongnu.org; Wed, 17 Feb 2016 13:11:11 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:14277 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW6Z9-0006tF-UB for qemu-devel@nongnu.org; Wed, 17 Feb 2016 13:11:08 -0500 Received: from irbis.sw.ru ([10.24.38.119]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u1HIArWP010157; Wed, 17 Feb 2016 21:10:54 +0300 (MSK) From: "Denis V. Lunev" To: Date: Wed, 17 Feb 2016 21:10:53 +0300 Message-Id: <1455732653-3106-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: nbd-general@lists.sourceforge.net, "Denis V. Lunev" , qemu-devel@nongnu.org Subject: [Qemu-devel] [RFC 1/1] nbd (specification): add NBD_CMD_WRITE_ZEROES command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch proposes a new command to reduce the amount of data passed through the wire when it is known that the data is all zeroes. This functionality is generally useful for mirroring or backup operations. Currently available NBD_CMD_TRIM command can not be used as the specification explicitely says that "a client MUST NOT make any assumptions about the contents of the export affected by this [NBD_CMD_TRIM] command, until overwriting it again with `NBD_CMD_WRITE`" Particular use case could be the following: QEMU project uses own implementation of NBD server to transfer data in between different instances of QEMU. Typically we tranfer VM virtual disks over this channel. VM virtual disks are sparse and thus the efficiency of backup and mirroring operations could be improved a lot. Signed-off-by: Denis V. Lunev --- doc/proto.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/proto.md b/doc/proto.md index 43065b7..c94751a 100644 --- a/doc/proto.md +++ b/doc/proto.md @@ -241,6 +241,8 @@ immediately after the global flags field in oldstyle negotiation: schedule I/O accesses as for a rotational medium - bit 5, `NBD_FLAG_SEND_TRIM`; should be set to 1 if the server supports `NBD_CMD_TRIM` commands +- bit 6, `NBD_FLAG_SEND_WRITE_ZEROES`; should be set to 1 if the server + supports `NBD_CMD_WRITE_ZEROES` commands ##### Client flags @@ -446,6 +448,11 @@ The following request types exist: about the contents of the export affected by this command, until overwriting it again with `NBD_CMD_WRITE`. +* `NBD_CMD_WRITE_ZEROES` (6) + + A request to write zeroes. The command is functional equivalent of + the NBD_WRITE_COMMAND but without payload sent through the channel. + * Other requests Some third-party implementations may require additional protocol