Message ID | 20191120140319.1505-2-kwolf@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: Fix resize (extending) of short overlays | expand |
On 11/20/19 8:03 AM, Kevin Wolf wrote: > bdrv_co_do_pwrite_zeroes() can already cope with maximum request sizes > by calling the driver in a loop until everything is done. Make the small > remaining change that is necessary to let it accept a 64 bit byte count. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > block/io.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Eric Blake <eblake@redhat.com>
20.11.2019 17:03, Kevin Wolf wrote: > bdrv_co_do_pwrite_zeroes() can already cope with maximum request sizes > by calling the driver in a loop until everything is done. Make the small > remaining change that is necessary to let it accept a 64 bit byte count. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
On Wed 20 Nov 2019 03:03:14 PM CET, Kevin Wolf wrote: > bdrv_co_do_pwrite_zeroes() can already cope with maximum request sizes > by calling the driver in a loop until everything is done. Make the small > remaining change that is necessary to let it accept a 64 bit byte count. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Berto
diff --git a/block/io.c b/block/io.c index f75777f5ea..003f4ea38c 100644 --- a/block/io.c +++ b/block/io.c @@ -42,7 +42,7 @@ static void bdrv_parent_cb_resize(BlockDriverState *bs); static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags); + int64_t offset, int64_t bytes, BdrvRequestFlags flags); static void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore, bool ignore_bds_parents) @@ -1730,7 +1730,7 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, } static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; @@ -1760,7 +1760,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, assert(max_write_zeroes >= bs->bl.request_alignment); while (bytes > 0 && !ret) { - int num = bytes; + int num = MIN(bytes, BDRV_REQUEST_MAX_BYTES); /* Align request. Block drivers can expect the "bulk" of the request * to be aligned, and that unaligned requests do not cross cluster
bdrv_co_do_pwrite_zeroes() can already cope with maximum request sizes by calling the driver in a loop until everything is done. Make the small remaining change that is necessary to let it accept a 64 bit byte count. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)