diff options
author | Alberto Garcia <berto@igalia.com> | 2017-06-19 16:40:03 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-06-26 14:51:13 +0200 |
commit | e034f5bcbc1139903b27c00bd832ee7c4b065810 (patch) | |
tree | 43ed75d6da2b0cc4fdae06fd749cea7a5a57b7ca /block/qcow2.h | |
parent | 026ac1586bdbd184e24082aa2bbab1fa3c48456b (diff) |
qcow2: Use unsigned int for both members of Qcow2COWRegion
Qcow2COWRegion has two attributes:
- The offset of the COW region from the start of the first cluster
touched by the I/O request. Since it's always going to be positive
and the maximum request size is at most INT_MAX, we can use a
regular unsigned int to store this offset.
- The size of the COW region in bytes. This is guaranteed to be >= 0,
so we should use an unsigned type instead.
In x86_64 this reduces the size of Qcow2COWRegion from 16 to 8 bytes.
It will also help keep some assertions simpler now that we know that
there are no negative numbers.
The prototype of do_perform_cow() is also updated to reflect these
changes.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r-- | block/qcow2.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/qcow2.h b/block/qcow2.h index 1801dc30dc..c26ee0a33d 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -301,10 +301,10 @@ typedef struct Qcow2COWRegion { * Offset of the COW region in bytes from the start of the first cluster * touched by the request. */ - uint64_t offset; + unsigned offset; /** Number of bytes to copy */ - int nb_bytes; + unsigned nb_bytes; } Qcow2COWRegion; /** |