Am 01.03.2018 um 08:25 hat Vladimir Sementsov-Ogievskiy geschrieben:
26.02.2018 17:05, Kevin Wolf wrote:
Essentially, assuming a simple backing chain 'base <- overlay', we got
these combinations to represent in NBD (with my suggestion of the flags
to use):
1. Cluster allocated in overlay
a. non-zero data 0
b. explicit zeroes 0 or ZERO
2. Cluster marked zero in overlay HOLE | ZERO
3. Cluster preallocated/zero in overlay ZERO
4. Cluster unallocated in overlay
a. Cluster allocated in base (non-zero) HOLE
b. Cluster allocated in base (zero) HOLE or HOLE | ZERO
c. Cluster marked zero in base HOLE | ZERO
d. Cluster preallocated/zero in base HOLE | ZERO
e. Cluster unallocated in base HOLE | ZERO
Instead of 'base' you can read 'anywhere in the backing chain' and the
flags should stay the same.
I think only "anywhere in the backing chain" is valid here. Otherwise,
semantics of bdrv_is_allocated would differ for NBD and for not-NBD.
This was meant as a mapping from cases to flags, not the other way
round, so really doesn't say anything about the cases where the block is
allocated further down the chain.
But yes, it shouldn't make a difference where in the backing chain a
block is allocated, so these cases are the same as 4.
I think, if bdrv_is_allocated returns false, it means that we can skip
this region in copying process, am I right?
-ENOCONTEXT? Which copying process?
There are cases where you want to copy such regions, and other cases
where you want to skip them. It depends on the use case. For example,
'qemu-img convert' skips them with -B (because the backing file is
reused), but not without -B (which creates a full copy).
Kevin