On Fri, Aug 17, 2018 at 10:28:49AM +0800, yang.bi...@zte.com.cn wrote: > > > > If there is no backing file or snapshot you still need to fill > > > > the cluster with zeroes, and that's going to be slower with > > > > larger clusters. > > > If not fill zeroes and only write guest data ,what`s wrong could > > > happen ? > > The following could happen: > > 1) Guest reads at offset [0, 4k] -> there's only zeroes > > 2) Guest writes at offset [8k, 16k] > > 3) Guest reads at offset [0, 4k] -> there's something else now
> Why could guest read the area at offset [0, 4k] has not be writen > yet ? Jakob already gave you some answers, but here's a simple one: because it might have already been written. If the guest wrote zeroes to [0, 1M] you can't generally assume that there's an allocated 1MB cluster on the qcow2 file filled with zeroes. - QEMU can detect that the guest tried to write zeroes and decide to leave the cluster unallocated (see for example the "detect_zeroes" option, or the "WRITE SAME" SCSI command). - The qcow2 file could have been converted at some point, and zero-filled clusters could have been deallocated for efficiency. Berto