From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cA3XY-0007II-Lf for qemu-devel@nongnu.org; Thu, 24 Nov 2016 18:34:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cA3XX-0002Lu-W1 for qemu-devel@nongnu.org; Thu, 24 Nov 2016 18:34:52 -0500 References: <20161115063715.12561-1-pbutsykin@virtuozzo.com> <20161115063715.12561-2-pbutsykin@virtuozzo.com> <20161123142851.GB5068@noname.redhat.com> From: Pavel Butsykin Message-ID: <5836C7DB.5000109@virtuozzo.com> Date: Thu, 24 Nov 2016 13:58:35 +0300 MIME-Version: 1.0 In-Reply-To: <20161123142851.GB5068@noname.redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 01/18] block/io: add bdrv_aio_{preadv, pwritev} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, den@openvz.org, famz@redhat.com, stefanha@redhat.com, mreitz@redhat.com, eblake@redhat.com On 23.11.2016 17:28, Kevin Wolf wrote: > Am 15.11.2016 um 07:36 hat Pavel Butsykin geschrieben: >> It's just byte-based wrappers over bdrv_co_aio_prw_vector(), which provide >> a byte-based interface for AIO read/write. >> >> Signed-off-by: Pavel Butsykin > > I'm in the process to phase out the last users of bdrv_aio_*() so that > this set of interfaces can be removed. I'm doing this because it's an > unnecessary redundancy, we have too many wrapper functions that expose > the same functionality with different syntax. So let's not add new > users. > > At first sight, you don't even seem to use bdrv_aio_preadv() for actual > parallelism, but you often have a pattern like this: > > void foo_cb(void *opaque) > { > ... > qemu_coroutine_enter(acb->co); > } > > void caller() > { > ... > acb = bdrv_aio_preadv(...); > qemu_coroutine_yield(); > } > > The code will actually become a lot simpler if you use bdrv_co_preadv() > instead because you don't have to have a callback, but you get pure > sequential code. > > The part that actually has some parallelism, pcache_readahead_request(), > already creates its own coroutine, so it runs in the background without > using callback-style interfaces. I used bdrv_co_preadv(), because it conveniently solves the partial cache hit. To solve the partial cache hit, we need to split a request into smaller parts, make asynchronous requests and wait for all requests in one place. Do you propose to create a coroutine for each part of request? It seemed to me that bdrv_co_preadv() is a wrapper that allows us to get rid of the same code. > Kevin >