From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDB14-0000GP-J5 for qemu-devel@nongnu.org; Wed, 15 Jun 2016 09:38:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDB13-0008Pp-JP for qemu-devel@nongnu.org; Wed, 15 Jun 2016 09:37:58 -0400 References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-5-git-send-email-eblake@redhat.com> From: Paolo Bonzini Message-ID: <8311ab35-28c3-a21a-df69-9a969264d2fa@redhat.com> Date: Wed, 15 Jun 2016 15:37:42 +0200 MIME-Version: 1.0 In-Reply-To: <1465939839-30097-5-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 04/17] nbd: Allow larger requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, Max Reitz On 14/06/2016 23:30, Eric Blake wrote: > 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 > > --- > v2: new patch > --- > include/block/nbd.h | 1 + > block/nbd-client.c | 4 ---- > 2 files changed, 1 insertion(+), 4 deletions(-) > > 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, > 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) > { > Acked-by: Paolo Bonzini