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