From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2t0s-0001RV-L0 for qemu-devel@nongnu.org; Mon, 13 Jan 2014 20:42:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2t0m-0004R3-MU for qemu-devel@nongnu.org; Mon, 13 Jan 2014 20:41:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2t0m-0004Qy-EL for qemu-devel@nongnu.org; Mon, 13 Jan 2014 20:41:48 -0500 Date: Tue, 14 Jan 2014 09:41:41 +0800 From: Fam Zheng Message-ID: <20140114014141.GA1377@T430.nay.redhat.com> References: <2014011323440947092624@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2014011323440947092624@163.com> Subject: Re: [Qemu-devel] Question about drive mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "rudyfly@163.com" Cc: "rudy.zhangmin" , qemu-devel On Mon, 01/13 23:44, rudyfly@163.com wrote: > Hi,everyone. > I tested the capability of drive mirror, I found the IO is low. Then I read the code, > The code mirror_run() will call mirror_iteration() to read the size of buffer data > from source storage, when the read callback ,and then in mirror_read_complete () > write the data to the target storage, It is serial. > Now, I hope when it is writing the data to target storage ,we can send the request > of reading data from source storage. Because of using coroutine to do it ,there is > some troubles to achieve it. why not use Multi-thread? > Some one can give me some idea? Hi, QEMU block layer has been using coroutine as the program model even before introducing these block jobs, so it was nature that block mirror followed this style. With coroutines, I believe it is as possible as with multi-thread, to have more outstanding IO requests, in order to speed up the mirroring. What's the trouble you have? Multi-threading needs much more synchronization mechanism than what we have in block interface now. One day it may be possible to move block job to a thread, but it will require quite some work. Fam