On 4/30/20 6:10 AM, Vladimir Sementsov-Ogievskiy wrote:
We are generally moving to int64_t for both offset and bytes parameters
on all io paths.
Main motivation is realization of 64-bit write_zeroes operation for
fast zeroing large disk chunks, up to the whole disk.
We chose signed type, to be consistent with off_t (which is signed) and
with possibility for signed return type (where negative value means
error).
So, prepare bdrv_co_do_pwrite_zeroes() now.
Patch-correctness audit by Eric Blake:
use of 'num' within the loop
compute 'int head' via % 'int alignment' - safe
clamp size by 'int max_write_zeroes' - safe
drv->bdrv_co_pwrite_zeroes(int) - safe because of clamping
clamp size by 'int max_transfer' - safe
qemu_iovec_init_buf(size_t) - safe because of clamping
bdrv_driver_pwritev(uint64_t) [well, int64_t after 4/17] - safe
I know you were quoting me, but the [comment] can be dropped (I wrote my
audit on patches in isolation while reviewing the pre-series state of
the tree, but when this commit is finally applied, the previous patch
will already be in place)
So even with the wider type, we aren't exceeding the contract of
anything we pass it on to. Later patches may improve
drv->bdrv_co_pwrite_zeroes and qemu_iovec_init_buf to be 64-bit
clean, at which point we would want to revisit this function to use
64-bit clamping rather than 32-bit clamping, but it does not have
to happen here.
Series: 64bit-block-status
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
Reviewed-by: Eric Blake <ebl...@redhat.com>
---
block/io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org