qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/6] block/nbd: Do not force-cap *pnum


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 5/6] block/nbd: Do not force-cap *pnum
Date: Sat, 19 Jun 2021 13:53:24 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

17.06.2021 18:52, Max Reitz wrote:
bdrv_co_block_status() does it for us, we do not need to do it here.

The advantage of not capping *pnum is that bdrv_co_block_status() can
cache larger data regions than requested by its caller.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
  block/nbd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/nbd.c b/block/nbd.c
index 616f9ae6c4..930bd234de 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1702,7 +1702,7 @@ static int coroutine_fn nbd_client_co_block_status(
          .type = NBD_CMD_BLOCK_STATUS,
          .from = offset,
          .len = MIN(QEMU_ALIGN_DOWN(INT_MAX, bs->bl.request_alignment),
-                   MIN(bytes, s->info.size - offset)),
+                   s->info.size - offset),
          .flags = NBD_CMD_FLAG_REQ_ONE,
      };

Hmm..

I don't that this change is correct. In contrast with file-posix you don't get 
extra information for free, you just make a larger request. This means that 
server will have to do more work.

(look at blockstatus_to_extents, it calls bdrv_block_status_above in a loop).

For example, assume that nbd export is a qcow2 image with all clusters 
allocated. With this change, nbd server will loop through the whole qcow2 
image, load all L2 tables to return big allocated extent.

So, only server can decide, could it add some extra free information to request 
or not. But unfortunately NBD_CMD_FLAG_REQ_ONE doesn't allow it.

--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]