On Tue, Aug 28, 2012 at 2:25 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 28/08/2012 15:04, Stefan Hajnoczi ha scritto: >> Zero writes have cluster granularity in QED. Therefore they can only be >> used to zero entire clusters. >> >> If the zero write request leaves sectors untouched, zeroing the entire >> cluster would obscure the backing file. Instead return -ENOTSUP, which >> is handled by block.c:bdrv_co_do_write_zeroes() and falls back to a >> regular write. >> >> The qemu-iotests 034 test cases covers this scenario. > > Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> > > Makes sense since both streaming and copy-on-read will do cluster-aligned > writes. > > The "right fix" would not be much more complex though, something like this, > right? > (untested).
Yes but it's more complicated. To do a really good job we should slice off the first/last clusters if they are unaligned, handle them like regular allocating writes, and handle the middle of the request as a zero write. I decided to do the simplest implementation since this scenario only occurs in test cases, not real guests. Stefan