From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvib-0001kt-KI for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:37:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHviV-0007zn-Hf for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:37:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHviV-0007zc-8O for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:37:07 -0500 Message-ID: <530B4AF8.9000605@redhat.com> Date: Mon, 24 Feb 2014 14:36:56 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <93A91DC620F1514FB39E878E5131C8CF0E3607FF@nkgeml511-mbx.china.huawei.com> <20140224132023.GC15488@stefanha-thinkpad.redhat.com> In-Reply-To: <20140224132023.GC15488@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] drive-mirror: Change the amount of data base on granularity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , "Chentao (Boby)" Cc: Kevin Wolf , Fam Zheng , "Wangting (Kathy)" , qemu-devel , Qinling , "Zhangmin (Rudy)" , "Wubin (H)" Il 24/02/2014 14:20, Stefan Hajnoczi ha scritto: >> Now, I change the amount of data in an iteration, it base on >> granularity. We can set the granularity to 1M,so it can send >> >> 10 times read request, and then send write request. Once a write >> request is done, it will have 1M free buffer to send next read >> request. >> >> So this way can allow read/write to be parallelized. This also means that in the dirty phase you have to send chunks of 1M instead of say 64K. 64K is a common value of the granularity. Try plotting the I/O rate against the granularity, you'll see that you will not get top utilization at 10M, but you will not get it at 64K either. What you need is probably as simple as this: $ git diff block/mirror.c diff --git a/block/mirror.c b/block/mirror.c index e683959..66093da 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -231,7 +231,7 @@ static void coroutine_fn mirror_iteration(MirrorBlockJob *s) nb_chunks += added_chunks; next_sector += added_sectors; next_chunk += added_chunks; - } while (next_sector < end); + } while (nb_sectors < MAX_SECTORS_PER_MIRROR_OP && next_sector < end); /* Allocate a MirrorOp that is used as an AIO callback. */ op = g_slice_new(MirrorOp); for some value of MAX_SECTORS_PER_MIRROR_OP. You will need to run some benchmarks in order to find the right value. Paolo