[sheepdog] [PATCH v3 02/17] block: use int64_t as bytes type in tracked requests
eblake at redhat.com
Fri May 22 21:09:07 CEST 2020
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
> So, convert tracked requests now.
> Series: 64bit-block-status
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
> Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com>
> Reviewed-by: Eric Blake <eblake at redhat.com>
> static void tracked_request_begin(BdrvTrackedRequest *req,
> BlockDriverState *bs,
> int64_t offset,
> - uint64_t bytes,
> + int64_t bytes,
> enum BdrvTrackedRequestType type)
> - assert(bytes <= INT64_MAX && offset <= INT64_MAX - bytes);
> + assert(offset >= 0 && bytes >= 0 &&
> + bytes <= INT64_MAX && offset <= INT64_MAX - bytes);
'bytes <= INT64_MAX' was previously a real runtime check, but is now a
tautology and therefore a dead branch; a picky compiler might complain.
This assert could be compressed to:
assert(offset >= 0 && (uint64_t) bytes <= INT64_MAX - offset);
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the sheepdog