From nobody Sun Oct 5 19:25:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525209356567639.676147397304; Tue, 1 May 2018 14:15:56 -0700 (PDT) Received: from localhost ([::1]:46212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDccs-0008MD-VP for importer@patchew.org; Tue, 01 May 2018 17:15:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDcav-0006m2-VC for qemu-devel@nongnu.org; Tue, 01 May 2018 17:13:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDcau-0001Zx-Re for qemu-devel@nongnu.org; Tue, 01 May 2018 17:13:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36450 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fDcaq-0001Ws-MH; Tue, 01 May 2018 17:13:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51993830B845; Tue, 1 May 2018 21:13:48 +0000 (UTC) Received: from red.redhat.com (ovpn-123-248.rdu2.redhat.com [10.10.123.248]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC0F3214138C; Tue, 1 May 2018 21:13:47 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 1 May 2018 16:13:33 -0500 Message-Id: <20180501211336.986372-2-eblake@redhat.com> In-Reply-To: <20180501211336.986372-1-eblake@redhat.com> References: <20180501211336.986372-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 01 May 2018 21:13:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 01 May 2018 21:13:48 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/4] nbd: Prepare for additional block sizing info 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: Kevin Wolf , vsementsov@virtuozzo.com, qemu-block@nongnu.org, Max Reitz , Paolo Bonzini , edgar.kaziakhmedov@virtuozzo.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The NBD spec is clarifying [1] that a server may want to advertise different limits for READ/WRITE (in our case, 32M) than for TRIM/ZERO (in our case, nearly 4G). Add the constants and name lookups for new NBD_INFO_ fields used during handshake to convey this additional information. Note that the NBD spec already requires servers to ignore unknown requests from the client, and for clients to ignore unknown gratuitous responses sent from the server. [1] https://lists.debian.org/nbd/2018/03/msg00048.html Signed-off-by: Eric Blake Reviewed-by:=C2=A0 Vladimir Sementsov-Ogievskiy --- The given URL for the NBD spec was v3; it will change to be a v4 version of that patch in part to point back to this qemu commit as a proof of implementation. --- include/block/nbd.h | 4 +++- nbd/common.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/block/nbd.h b/include/block/nbd.h index fcdcd545023..cbf51628f78 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Red Hat, Inc. + * Copyright (C) 2016-2018 Red Hat, Inc. * Copyright (C) 2005 Anthony Liguori * * Network Block Device @@ -180,6 +180,8 @@ typedef struct NBDExtent { #define NBD_INFO_NAME 1 #define NBD_INFO_DESCRIPTION 2 #define NBD_INFO_BLOCK_SIZE 3 +#define NBD_INFO_TRIM_SIZE 4 +#define NBD_INFO_ZERO_SIZE 5 /* Request flags, sent from client to server during transmission phase */ #define NBD_CMD_FLAG_FUA (1 << 0) /* 'force unit access' during wri= te */ diff --git a/nbd/common.c b/nbd/common.c index 8c95c1d606e..840c91d5ca4 100644 --- a/nbd/common.c +++ b/nbd/common.c @@ -129,6 +129,10 @@ const char *nbd_info_lookup(uint16_t info) return "description"; case NBD_INFO_BLOCK_SIZE: return "block size"; + case NBD_INFO_TRIM_SIZE: + return "trim size"; + case NBD_INFO_ZERO_SIZE: + return "zero size"; default: return ""; } --=20 2.14.3