From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF05A-0003sM-Le for qemu-devel@nongnu.org; Fri, 21 Sep 2012 06:03:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF054-0008Ta-PU for qemu-devel@nongnu.org; Fri, 21 Sep 2012 06:03:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF054-0008TP-Hh for qemu-devel@nongnu.org; Fri, 21 Sep 2012 06:03:30 -0400 Message-ID: <505C3B6C.9030906@redhat.com> Date: Fri, 21 Sep 2012 12:03:24 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <4c21c62fb42b878221a65ea97ad5fd5701f2a0fe.1348157913.git.jcody@redhat.com> In-Reply-To: <4c21c62fb42b878221a65ea97ad5fd5701f2a0fe.1348157913.git.jcody@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 04/19] block: move aio initialization into a helper function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: pbonzini@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org, supriyak@linux.vnet.ibm.com Am 20.09.2012 21:13, schrieb Jeff Cody: > Move AIO initialization for raw-posix block driver into a helper function. > > In addition to just code motion, the aio_ctx pointer is checked for NULL, > prior to calling laio_init(), to make sure laio_init() is only run once. > > Signed-off-by: Jeff Cody > --- > block/raw-posix.c | 53 +++++++++++++++++++++++++++++++++++------------------ > 1 file changed, 35 insertions(+), 18 deletions(-) > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 6be20b1..5981d04 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -240,25 +272,10 @@ static int raw_open_common(BlockDriverState *bs, const char *filename, > } > > #ifdef CONFIG_LINUX_AIO > - /* > - * Currently Linux do AIO only for files opened with O_DIRECT > - * specified so check NOCACHE flag too > - */ > - if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) == > - (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) { > - > - s->aio_ctx = laio_init(); > - if (!s->aio_ctx) { > - goto out_free_buf; > - } > - s->use_aio = 1; > - } else > -#endif > - { > -#ifdef CONFIG_LINUX_AIO > - s->use_aio = 0; > -#endif > + if (raw_set_aio(&s->aio_ctx, &s->use_aio, bdrv_flags)) { > + goto out_close; This leaks s->aligned_buf. It's removed later in the series anyway, so no big deal, but if you need to respin for other reasons, probably worth fixing. Kevin