From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGDFm-0003e2-1K for qemu-devel@nongnu.org; Thu, 23 Jun 2016 18:37:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGDFh-0005rk-SA for qemu-devel@nongnu.org; Thu, 23 Jun 2016 18:37:41 -0400 From: Eric Blake Date: Thu, 23 Jun 2016 16:37:08 -0600 Message-Id: <1466721446-27737-5-git-send-email-eblake@redhat.com> In-Reply-To: <1466721446-27737-1-git-send-email-eblake@redhat.com> References: <1466721446-27737-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v3 04/22] nbd: Allow larger requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, qemu-stable@nongnu.org, Paolo Bonzini , Max Reitz The NBD layer was breaking up request at a limit of 2040 sectors (just under 1M) to cater to old qemu-nbd. But the server limit was raised to 32M in commit 2d8214885 to match the kernel, more than three years ago; and the upstream NBD Protocol is proposing documentation that without any explicit communication to state otherwise, a client should be able to safely assume that a 32M transaction will work. It is time to rely on the larger sizing, and any downstream distro that cares about maximum interoperability to older qemu-nbd servers can just tweak the value of #define NBD_MAX_SECTORS. Signed-off-by: Eric Blake Reviewed-by: Kevin Wolf Acked-by: Paolo Bonzini Cc: qemu-stable@nongnu.org Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- v3: rebase to master, cc qemu-stable v2: new patch --- include/block/nbd.h | 2 ++ block/nbd-client.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/block/nbd.h b/include/block/nbd.h index df1f804..eeda3eb 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -77,6 +77,8 @@ enum { /* Maximum size of a single READ/WRITE data buffer */ #define NBD_MAX_BUFFER_SIZE (32 * 1024 * 1024) +#define NBD_MAX_SECTORS (NBD_MAX_BUFFER_SIZE / BDRV_SECTOR_SIZE) + /* Maximum size of an export name. The NBD spec requires 256 and * suggests that servers support up to 4096, but we stick to only the * required size so that we can stack-allocate the names, and because diff --git a/block/nbd-client.c b/block/nbd-client.c index 4d13444..420bce8 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -269,10 +269,6 @@ static int nbd_co_writev_1(BlockDriverState *bs, int64_t sector_num, return -reply.error; } -/* qemu-nbd has a limit of slightly less than 1M per request. Try to - * remain aligned to 4K. */ -#define NBD_MAX_SECTORS 2040 - int nbd_client_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { -- 2.5.5