From patchwork Tue Jul 5 15:50:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9214987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FA286048F for ; Tue, 5 Jul 2016 17:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EB0C27F3E for ; Tue, 5 Jul 2016 17:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3150827F4B; Tue, 5 Jul 2016 17:33:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C00027F3E for ; Tue, 5 Jul 2016 17:33:28 +0000 (UTC) Received: from localhost ([::1]:56593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKUDv-0007Cc-DA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Jul 2016 13:33:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSd7-0000kl-EI for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSd6-0006Ui-Aa for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSd0-0006S1-Bb; Tue, 05 Jul 2016 11:51:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF65D1176A5; Tue, 5 Jul 2016 15:51:13 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u65Fp6fG006758; Tue, 5 Jul 2016 11:51:12 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 5 Jul 2016 17:50:14 +0200 Message-Id: <1467733852-27097-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com> References: <1467733852-27097-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 05 Jul 2016 15:51:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/43] nbd: Allow larger requests 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, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- block/nbd-client.c | 4 ---- include/block/nbd.h | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) 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) { 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