[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 02/17] block: use int64_t as bytes type in tracked request
From: |
Eric Blake |
Subject: |
Re: [PATCH v3 02/17] block: use int64_t as bytes type in tracked requests |
Date: |
Fri, 22 May 2020 14:09:07 -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, convert tracked requests now.
Series: 64bit-block-status
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
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