> About 4KB zero tracking: > > The vma.py module does not check for zeros, the mask is always 0xffff. > There is a pathalogical case of a disk with every 2nd 4 KB block zeroed, here > vma.py would create a fully-allocated file.But the more common case is that > the > whole 64 KB cluster is zero - think about the fact that qcow2/qed only do > discard > (zero clusters) at cluster level > (64 KB). > > Also, if you try hard to zero 4 KB blocks then two things can happen: > 1. You fragment the file, saving space now but turning sequential access into > random access once those zero regions get filled in. > 2. The underlying file system ignores the holes to reduce fragmentation and > all > the effort was wasted - I guess this can be checked with ioctl(FIEMAP/FIBMAP) > to see how ext4/xfs/btrfs handle it.
We track zero blocks at 4KB level to get small backup files. Restore can handle those blocks differently, either pre-allocate or create holes. That can even be a restore option.