From patchwork Thu May 26 07:10:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 9136715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B44156075C for ; Thu, 26 May 2016 07:10:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8D7328221 for ; Thu, 26 May 2016 07:10:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D2A1282E1; Thu, 26 May 2016 07:10:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 472AB28221 for ; Thu, 26 May 2016 07:10:50 +0000 (UTC) Received: from localhost ([::1]:37140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5pRQ-0001EO-9m for patchwork-qemu-devel@patchwork.kernel.org; Thu, 26 May 2016 03:10:48 -0400 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 Received: from mx1.redhat.com ([209.132.183.28]:49815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5pR4-00051Q-Fk; Thu, 26 May 2016 03:10:26 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B980E63165; Thu, 26 May 2016 07:10:25 +0000 (UTC) Received: from localhost (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4Q7AN76008945; Thu, 26 May 2016 03:10:24 -0400 Date: Thu, 26 May 2016 15:10:24 +0800 From: Fam Zheng To: Peter Lieven 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-Disposition: inline In-Reply-To: <20160526065045.GA10734@ad.usersys.redhat.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 May 2016 07:10:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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); } }