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). diff --git a/block/qed.c b/block/qed.c index a02dbfd..a885671 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1133,8 +1133,14 @@ static void qed_aio_write_alloc(QEDAIOCB *acb, size_t len) return; } + if (qed_offset_into_cluster(s, acb->cur_pos) != 0 || + qed_offset_into_cluster(s, acb->cur_pos + acb->cur_qiov.size) != 0) { + goto copy; + } + cb = qed_aio_write_zero_cluster; } else { +copy: cb = qed_aio_write_prefill; acb->cur_cluster = qed_alloc_clusters(s, acb->cur_nclusters); } Paolo