On Thu, 05/26 14:50, Fam Zheng wrote: > On Tue, 05/24 16:30, Peter Lieven wrote: > > in a read-modify-write cycle a small request might cause > > head and tail to fall into the same aligned block. Currently > > QEMU reads the same block twice in this case which is > > not necessary. > > > > Signed-off-by: Peter Lieven <p...@kamp.de> > > Thanks, applied to my block branch: > > https://github.com/famz/qemu/tree/block >
Looks like this breaks iotests 077 (hang), the blkdebug break points expected by the script are not hit now. While squashing in below patch fixes the case, I think it is more appropriate to keep the patch as is and fix the case itself. Dropped from my queue, please send another version with test case update so I can apply together. diff --git a/block/io.c b/block/io.c index d480097..a6523cf 100644 --- a/block/io.c +++ b/block/io.c @@ -1435,8 +1435,10 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs, * than one aligned block. */ if (bytes < align) { + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL); qemu_iovec_add(&local_qiov, head_buf + bytes, align - bytes); bytes = align; + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL); } }