From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5pRA-0001AY-7B for qemu-devel@nongnu.org; Thu, 26 May 2016 03:10:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5pR9-00052m-13 for qemu-devel@nongnu.org; Thu, 26 May 2016 03:10:32 -0400 Date: Thu, 26 May 2016 15:10:24 +0800 From: Fam Zheng Message-ID: <20160526071024.GB10734@ad.usersys.redhat.com> References: <1464100220-21317-1-git-send-email-pl@kamp.de> <20160526065045.GA10734@ad.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160526065045.GA10734@ad.usersys.redhat.com> Subject: Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com 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 > > 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); } }