[sheepdog] [PATCH v3 03/17] block/io: use int64_t bytes parameter in bdrv_check_byte_request()
berto at igalia.com
Mon May 11 17:57:15 CEST 2020
On Thu 30 Apr 2020 01:10:19 PM CEST, 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
> So, convert bdrv_check_byte_request() now.
> Patch-correctness audit by Eric Blake:
> This changes an unsigned to signed value on 64-bit machines, and
> additionally widens the parameter on 32-bit machines. Existing
> bdrv_co_preadv_part() with 'unsigned int' - no impact
> bdrv_co_pwritev_part() with 'unsigned int' - no impact
> bdrv_co_copy_range_internal() with 'uint64_t' -
> potentially fixes a latent bug on 32-bit machines. Requires a
> larger audit to see how bdrv_co_copy_range() and friends are
> block/block-backend.c:blk_co_copy_range() - passes 'int', thus < 2G
> block/block-copy.c:block_copy_do_copy() -
> passes 'int64_t', but only after assert(nbytes < INT_MAX); also
> it has a BLOCK_COPY_MAX_COPY_RANGE set to 16M that factors into
> its calculations on how much to do per iteration
> So it looks like at present we are safe.
> Series: 64bit-block-status
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
> Reviewed-by: Eric Blake <eblake at redhat.com>
Reviewed-by: Alberto Garcia <berto at igalia.com>
More information about the sheepdog