[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/17] nbd: Advertise realistic limits to blo
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/17] nbd: Advertise realistic limits to block layer |
Date: |
Wed, 22 Jun 2016 14:58:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/15/2016 07:38 AM, Paolo Bonzini wrote:
>
>
> 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.
>>
>> 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 <address@hidden>
> Cc: address@hidden
This one won't apply on stable without the previous one; for that
matter, it is the previous one that actually changes behavior (until
later patches land, the block layer is ignoring what NBD advertises to
the block layer), while this one has no discernible effect except
avoiding latent bugs on future patches. So in my v3 series, I'm only
putting CC: stable on 4/17, not 5.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 04/17] nbd: Allow larger requests, (continued)
- [Qemu-devel] [PATCH v2 01/17] block: Tighter assertions on bdrv_aligned_pwritev(), Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 02/17] block: Document supported flags during bdrv_aligned_preadv(), Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 05/17] nbd: Advertise realistic limits to block layer, Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 03/17] block: Fix harmless off-by-one in bdrv_aligned_preadv(), Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 13/17] block: Set default request_alignment during bdrv_refresh_limits(), Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 11/17] raw-win32: Set request_alignment during .bdrv_refresh_limits(), Eric Blake, 2016/06/14
- [Qemu-devel] [PATCH v2 07/17] block: Give nonzero result to blk_get_max_transfer_length(), Eric Blake, 2016/06/14