[PATCH 1/5] block/nbd-client: drop max_block restriction from block_status

Vladimir Sementsov-Ogievskiy posted 5 patches 5 years, 8 months ago
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
[PATCH 1/5] block/nbd-client: drop max_block restriction from block_status
Posted by Vladimir Sementsov-Ogievskiy 5 years, 8 months ago
NBD spec is updated, so that max_block doesn't relate to
NBD_CMD_BLOCK_STATUS. So, drop the restriction.

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

diff --git a/block/nbd.c b/block/nbd.c
index 976be76647..2a58d6b91c 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1320,9 +1320,7 @@ static int coroutine_fn nbd_client_co_block_status(
     NBDRequest request = {
         .type = NBD_CMD_BLOCK_STATUS,
         .from = offset,
-        .len = MIN(MIN_NON_ZERO(QEMU_ALIGN_DOWN(INT_MAX,
-                                                bs->bl.request_alignment),
-                                s->info.max_block),
+        .len = MIN(QEMU_ALIGN_DOWN(INT_MAX, bs->bl.request_alignment),
                    MIN(bytes, s->info.size - offset)),
         .flags = NBD_CMD_FLAG_REQ_ONE,
     };
-- 
2.21.0


Re: [PATCH 1/5] block/nbd-client: drop max_block restriction from block_status
Posted by Eric Blake 5 years, 8 months ago
On 3/2/20 4:05 AM, Vladimir Sementsov-Ogievskiy wrote:
> NBD spec is updated, so that max_block doesn't relate to
> NBD_CMD_BLOCK_STATUS. So, drop the restriction.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   block/nbd.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/block/nbd.c b/block/nbd.c
> index 976be76647..2a58d6b91c 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -1320,9 +1320,7 @@ static int coroutine_fn nbd_client_co_block_status(
>       NBDRequest request = {
>           .type = NBD_CMD_BLOCK_STATUS,
>           .from = offset,
> -        .len = MIN(MIN_NON_ZERO(QEMU_ALIGN_DOWN(INT_MAX,
> -                                                bs->bl.request_alignment),
> -                                s->info.max_block),
> +        .len = MIN(QEMU_ALIGN_DOWN(INT_MAX, bs->bl.request_alignment),
>                      MIN(bytes, s->info.size - offset)),

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

We're still capped at 32 bits (instead of status over the entire 
device), but future NBD extensions will get to that.  In the meantime, 
this is a lot nicer than having to stick to 32M per request.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org