diff options
| author | Hanna Reitz <hreitz@redhat.com> | 2021-08-12 10:41:47 +0200 |
|---|---|---|
| committer | Hanna Reitz <hreitz@redhat.com> | 2021-09-15 15:54:07 +0200 |
| commit | 72b4cabe5e92b131dcb954691f579e59eb9103e3 (patch) | |
| tree | 6f25c5ca232917c2de00d402b28632784889b9e3 | |
| parent | 869e7ee827ebf9392ed100119cc7e21a81311536 (diff) | |
| download | focaccia-qemu-72b4cabe5e92b131dcb954691f579e59eb9103e3.tar.gz focaccia-qemu-72b4cabe5e92b131dcb954691f579e59eb9103e3.zip | |
block/gluster: Do not force-cap *pnum
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: Hanna Reitz <hreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210812084148.14458-6-hreitz@redhat.com>
| -rw-r--r-- | block/gluster.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/block/gluster.c b/block/gluster.c index 48a04417cf..d51938e447 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1461,7 +1461,8 @@ exit: * the specified offset) that are known to be in the same * allocated/unallocated state. * - * 'bytes' is the max value 'pnum' should be set to. + * 'bytes' is a soft cap for 'pnum'. If the information is free, 'pnum' may + * well exceed it. * * (Based on raw_co_block_status() from file-posix.c.) */ @@ -1502,7 +1503,7 @@ static int coroutine_fn qemu_gluster_co_block_status(BlockDriverState *bs, } else if (data == offset) { /* On a data extent, compute bytes to the end of the extent, * possibly including a partial sector at EOF. */ - *pnum = MIN(bytes, hole - offset); + *pnum = hole - offset; /* * We are not allowed to return partial sectors, though, so @@ -1521,7 +1522,7 @@ static int coroutine_fn qemu_gluster_co_block_status(BlockDriverState *bs, } else { /* On a hole, compute bytes to the beginning of the next extent. */ assert(hole == offset); - *pnum = MIN(bytes, data - offset); + *pnum = data - offset; ret = BDRV_BLOCK_ZERO; } |