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.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>
Reviewed-by: Eric Blake <ebl...@redhat.com>
static void tracked_request_begin(BdrvTrackedRequest *req,
- 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