diff mbox series

[v2,2/6] block/nbd-client: drop max_block restriction from discard

Message ID 20200401150112.9557-3-vsementsov@virtuozzo.com
State New
Headers show
Series nbd: reduce max_block restrictions | expand

Commit Message

Vladimir Sementsov-Ogievskiy April 1, 2020, 3:01 p.m. UTC
NBD spec is updated, so that max_block doesn't relate to
NBD_CMD_TRIM. So, drop the restriction.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake April 21, 2020, 9:56 p.m. UTC | #1
On 4/1/20 10:01 AM, Vladimir Sementsov-Ogievskiy wrote:
> NBD spec is updated, so that max_block doesn't relate to
> NBD_CMD_TRIM. So, drop the restriction.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   block/nbd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

I might tweak the commit message of 1/6 and here to call out the NBD 
spec commit id (nbd.git 9f30fedb), but that doesn't change the patch proper.

> 
> diff --git a/block/nbd.c b/block/nbd.c
> index d4d518a780..4ac23c8f62 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -1955,7 +1955,7 @@ static void nbd_refresh_limits(BlockDriverState *bs, Error **errp)
>       }
>   
>       bs->bl.request_alignment = min;
> -    bs->bl.max_pdiscard = max;
> +    bs->bl.max_pdiscard = QEMU_ALIGN_DOWN(INT_MAX, min);
>       bs->bl.max_pwrite_zeroes = max;
>       bs->bl.max_transfer = max;
>   
>
Eric Blake May 4, 2020, 7:59 p.m. UTC | #2
On 4/21/20 4:56 PM, Eric Blake wrote:
> On 4/1/20 10:01 AM, Vladimir Sementsov-Ogievskiy wrote:
>> NBD spec is updated, so that max_block doesn't relate to
>> NBD_CMD_TRIM. So, drop the restriction.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   block/nbd.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> I might tweak the commit message of 1/6 and here to call out the NBD 
> spec commit id (nbd.git 9f30fedb), but that doesn't change the patch 
> proper.

I'm queuing 1 and 2 through my NBD tree now; the rest involve more of 
the block layer and go in tandem with your other work on cleaning up 
64-bit operations throughout, and I still need to give that a better review.
Vladimir Sementsov-Ogievskiy May 6, 2020, 6:08 a.m. UTC | #3
04.05.2020 22:59, Eric Blake wrote:
> On 4/21/20 4:56 PM, Eric Blake wrote:
>> On 4/1/20 10:01 AM, Vladimir Sementsov-Ogievskiy wrote:
>>> NBD spec is updated, so that max_block doesn't relate to
>>> NBD_CMD_TRIM. So, drop the restriction.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> ---
>>>   block/nbd.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>
>> I might tweak the commit message of 1/6 and here to call out the NBD spec commit id (nbd.git 9f30fedb), but that doesn't change the patch proper.
> 
> I'm queuing 1 and 2 through my NBD tree now; the rest involve more of the block layer and go in tandem with your other work on cleaning up 64-bit operations throughout, and I still need to give that a better review.
> 

Thank you!
diff mbox series

Patch

diff --git a/block/nbd.c b/block/nbd.c
index d4d518a780..4ac23c8f62 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1955,7 +1955,7 @@  static void nbd_refresh_limits(BlockDriverState *bs, Error **errp)
     }
 
     bs->bl.request_alignment = min;
-    bs->bl.max_pdiscard = max;
+    bs->bl.max_pdiscard = QEMU_ALIGN_DOWN(INT_MAX, min);
     bs->bl.max_pwrite_zeroes = max;
     bs->bl.max_transfer = max;