Received: from eggs.gnu.org ([2001:4830:134:3::10]:42129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkO-0004Fu-DN for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWrkL-00064T-7c for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkK-00064J-V0 for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:05 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u78KxqHO121904 for ; Mon, 8 Aug 2016 17:06:04 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 24nce8futj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 Aug 2016 17:06:04 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Aug 2016 17:06:03 -0400 From: Michael Roth Date: Mon, 8 Aug 2016 16:04:09 -0500 In-Reply-To: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-Id: <1470690267-31454-39-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 38/56] nbd: Allow larger requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Eric Blake , Kevin Wolf From: Eric Blake 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 Signed-off-by: Kevin Wolf (cherry picked from commit 476b923c32ece0e268580776aaf1fab4ab4459a8) Conflicts: include/block/nbd.h * removed context dependency on 943cec86 Signed-off-by: Michael Roth --- block/nbd-client.c | 4 ---- include/block/nbd.h | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/block/nbd-client.c b/block/nbd-client.c index 878e879..6f6df46 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) { diff --git a/include/block/nbd.h b/include/block/nbd.h index b86a976..36dde24 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -76,6 +76,7 @@ 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) ssize_t nbd_wr_syncv(QIOChannel *ioc, struct iovec *iov, -- 1.9.1