From: Paolo Bonzini <pbonzini@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com,
qemu-stable <qemu-stable@nongnu.org>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 05/17] nbd: Advertise realistic limits to block layer
Date: Wed, 15 Jun 2016 15:38:19 +0200 [thread overview]
Message-ID: <1d8398f2-88b5-4eb9-48e1-f67c67608b96@redhat.com> (raw)
In-Reply-To: <1465939839-30097-6-git-send-email-eblake@redhat.com>
On 14/06/2016 23:30, Eric Blake wrote:
> We were basing the advertisement of maximum discard and transfer
> length off of UINT32_MAX, but since the rest of the block layer
> has signed int limits on a transaction, nothing could ever reach
> that maximum, and we risk overflowing an int once things are
> converted to byte-based rather than sector-based limits. What's
> more, we DO have a much smaller limit: both the current kernel
> and qemu-nbd have a hard limit of 32M on a read or write
> transaction, and while they may also permit up to a full 32 bits
> on a discard transaction, the upstream NBD protocol is proposing
> wording that without any explicit advertisement otherwise,
> clients should limit ALL requests to the same limits as read and
> write, even though the other requests do not actually require as
> many bytes across the wire. So the better limit to tell the
> block layer is 32M for both values.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v2: new patch
> ---
> block/nbd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/nbd.c b/block/nbd.c
> index 6015e8b..bf67c8a 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -362,8 +362,8 @@ static int nbd_co_flush(BlockDriverState *bs)
>
> static void nbd_refresh_limits(BlockDriverState *bs, Error **errp)
> {
> - bs->bl.max_discard = UINT32_MAX >> BDRV_SECTOR_BITS;
> - bs->bl.max_transfer_length = UINT32_MAX >> BDRV_SECTOR_BITS;
> + bs->bl.max_discard = NBD_MAX_SECTORS;
> + bs->bl.max_transfer_length = NBD_MAX_SECTORS;
> }
>
> static int nbd_co_discard(BlockDriverState *bs, int64_t sector_num,
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-stable@nongnu.org
next prev parent reply other threads:[~2016-06-15 13:38 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 21:30 [Qemu-devel] [PATCH v2 00/17] Byte-based block limits Eric Blake
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 01/17] block: Tighter assertions on bdrv_aligned_pwritev() Eric Blake
2016-06-16 5:05 ` Fam Zheng
2016-06-20 12:09 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 02/17] block: Document supported flags during bdrv_aligned_preadv() Eric Blake
2016-06-16 5:08 ` Fam Zheng
2016-06-20 12:10 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 03/17] block: Fix harmless off-by-one in bdrv_aligned_preadv() Eric Blake
2016-06-16 5:10 ` Fam Zheng
2016-06-20 12:12 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 04/17] nbd: Allow larger requests Eric Blake
2016-06-15 13:37 ` Paolo Bonzini
2016-06-16 5:12 ` Fam Zheng
2016-06-20 12:13 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 05/17] nbd: Advertise realistic limits to block layer Eric Blake
2016-06-15 13:38 ` Paolo Bonzini [this message]
2016-06-22 20:58 ` Eric Blake
2016-06-16 5:13 ` Fam Zheng
2016-06-20 12:14 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 06/17] iscsi: " Eric Blake
2016-06-16 5:19 ` Fam Zheng
2016-06-20 12:16 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 07/17] block: Give nonzero result to blk_get_max_transfer_length() Eric Blake
2016-06-16 5:25 ` Fam Zheng
2016-06-16 13:22 ` Paolo Bonzini
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 08/17] blkdebug: Set request_alignment during .bdrv_refresh_limits() Eric Blake
2016-06-16 5:27 ` Fam Zheng
2016-06-21 13:27 ` Kevin Wolf
2016-06-21 22:17 ` Eric Blake
2016-06-22 10:05 ` Kevin Wolf
2016-06-22 17:33 ` Eric Blake
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 09/17] iscsi: " Eric Blake
2016-06-16 5:28 ` Fam Zheng
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 10/17] qcow2: " Eric Blake
2016-06-16 5:28 ` Fam Zheng
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 11/17] raw-win32: " Eric Blake
2016-06-16 5:30 ` Fam Zheng
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 12/17] block: " Eric Blake
2016-06-16 5:31 ` Fam Zheng
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 13/17] block: Set default request_alignment during bdrv_refresh_limits() Eric Blake
2016-06-16 5:32 ` Fam Zheng
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 14/17] block: Switch transfer length bounds to byte-based Eric Blake
2016-06-16 5:42 ` Fam Zheng
2016-06-21 13:50 ` Kevin Wolf
2016-06-21 22:20 ` Eric Blake
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 15/17] block: Switch discard " Eric Blake
2016-06-16 5:46 ` Fam Zheng
2016-06-16 14:21 ` Eric Blake
2016-06-17 2:28 ` Fam Zheng
2016-06-21 14:05 ` Kevin Wolf
2016-06-21 22:21 ` Eric Blake
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 16/17] block: Split bdrv_merge_limits() from bdrv_refresh_limits() Eric Blake
2016-06-16 5:50 ` Fam Zheng
2016-06-16 14:22 ` Eric Blake
2016-06-21 14:12 ` Kevin Wolf
2016-06-21 22:24 ` Eric Blake
2016-06-14 21:30 ` [Qemu-devel] [PATCH v2 17/17] block: Move request_alignment into BlockLimit Eric Blake
2016-06-16 5:52 ` Fam Zheng
2016-06-21 14:16 ` Kevin Wolf
2016-06-21 22:26 ` Eric Blake
2016-06-22 10:14 ` Kevin Wolf
2016-06-21 14:18 ` [Qemu-devel] [PATCH v2 00/17] Byte-based block limits Kevin Wolf
2016-06-21 22:27 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d8398f2-88b5-4eb9-48e1-f67c67608b96@redhat.com \
--to=pbonzini@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).