qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v3 05/17] block/io: support int64_t bytes in bdrv_co_do_pwrit


From: Eric Blake
Subject: Re: [PATCH v3 05/17] block/io: support int64_t bytes in bdrv_co_do_pwrite_zeroes()
Date: Fri, 8 May 2020 13:20:29 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
  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




reply via email to

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