[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 2/7] qcow2: Use unsigned int for both members
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v2 2/7] qcow2: Use unsigned int for both members of Qcow2COWRegion |
Date: |
Thu, 08 Jun 2017 15:06:10 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Wed 07 Jun 2017 06:02:06 PM CEST, Eric Blake wrote:
>> - 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.
>
> I don't know if we will ever get to the point that we allow a 64-bit
> request at the block layer (and then the block layer guarantees it is
> split down to the driver's limits, which works when a driver is still
> bound by 32-bit limits). But we ALSO know that a cluster is at most
> 2M (in our current implementation of qcow2), so the offset of where
> the COW region starts in relation to the start of a cluster is < 2M.
That's correct for the offset of the first region (m->cow_start),
however m->cow_end is also relative to the offset of the first allocated
cluster, so it can be > 2M if the requests spans several clusters.
So I guess the maximum theoretical offset would be something like
INT_MAX + 2*cluster_size (a bit below that actually).
>> - The size of the COW region in bytes. This is guaranteed to be >= 0,
>> so we should use an unsigned type instead.
>
> And likewise, since a COW region is a sub-cluster, and clusters are
> bounded at 2M, we also have a sub-int upper bound on the size of the
> region.
That's correct.
Berto
- [Qemu-block] [PATCH v2 0/7] qcow2: Reduce the number of I/O ops when doing COW, Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 3/7] qcow2: Make perform_cow() call do_perform_cow() twice, Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}(), Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 5/7] qcow2: Allow reading both COW regions with only one request, Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 4/7] qcow2: Split do_perform_cow() into _read(), _encrypt() and _write(), Alberto Garcia, 2017/06/07