From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHsBp-0002Lk-8S for qemu-devel@nongnu.org; Tue, 28 Jun 2016 08:32:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHsBm-00035V-Bh for qemu-devel@nongnu.org; Tue, 28 Jun 2016 08:32:29 -0400 Received: from mail-db5eur01on0095.outbound.protection.outlook.com ([104.47.2.95]:63200 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHsBl-00035F-Nq for qemu-devel@nongnu.org; Tue, 28 Jun 2016 08:32:26 -0400 References: <1464686130-12265-1-git-send-email-den@openvz.org> <1464686130-12265-8-git-send-email-den@openvz.org> <20160628114707.GE6800@noname.redhat.com> From: Pavel Butsykin Message-ID: <57726E4D.4080501@virtuozzo.com> Date: Tue, 28 Jun 2016 15:32:13 +0300 MIME-Version: 1.0 In-Reply-To: <20160628114707.GE6800@noname.redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/11] block: optimization blk_pwrite_compressed() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , "Denis V. Lunev" Cc: qemu-devel@nongnu.org, Jeff Cody , Markus Armbruster , Eric Blake , John Snow , Stefan Hajnoczi On 28.06.2016 14:47, Kevin Wolf wrote: > Am 31.05.2016 um 11:15 hat Denis V. Lunev geschrieben: >> From: Pavel Butsykin >> >> For bdrv_pwrite_compressed() it looks like most of the code creating coroutine >> is duplicated in blk_prw(). So we can just add a flag(BDRV_REQ_WRITE_COMPRESSED) >> and use the blk_prw() as a generic one. >> >> Signed-off-by: Pavel Butsykin >> Signed-off-by: Denis V. Lunev >> CC: Jeff Cody >> CC: Markus Armbruster >> CC: Eric Blake >> CC: John Snow >> CC: Stefan Hajnoczi >> CC: Kevin Wolf > > Oh, so you already do use a flag. Nice. :-) > >> diff --git a/block/block-backend.c b/block/block-backend.c >> index 3c1fc50..9e1c793 100644 >> --- a/block/block-backend.c >> +++ b/block/block-backend.c >> @@ -785,7 +785,11 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, >> flags |= BDRV_REQ_FUA; >> } >> >> - return bdrv_co_pwritev(blk_bs(blk), offset, bytes, qiov, flags); >> + if (flags & BDRV_REQ_WRITE_COMPRESSED) { >> + return bdrv_co_pwritev_compressed(blk_bs(blk), offset, bytes, qiov); >> + } else { >> + return bdrv_co_pwritev(blk_bs(blk), offset, bytes, qiov, flags); >> + } >> } > > If you move the processing of the flag inside bdrv_co_pwritev(), where I > think it belongs anyway, you could use the flag from the start (by going > through bdrv_prwv_co()) instead of temporarily introducing your own > coroutine wrapper. I think that would make the initial conversion > patches quite a bit simpler. You propose to add bdrv_driver_compressed and call it from bdrv_aligned_pwritev ? > Kevin >