From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36734 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBkqe-0002RT-Ew for qemu-devel@nongnu.org; Tue, 11 May 2010 04:29:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBkqb-0005nN-PM for qemu-devel@nongnu.org; Tue, 11 May 2010 04:29:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65266) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBkqb-0005nE-GL for qemu-devel@nongnu.org; Tue, 11 May 2010 04:29:49 -0400 Message-ID: <4BE91560.1060407@redhat.com> Date: Tue, 11 May 2010 10:29:20 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1273528310-7051-1-git-send-email-agraf@suse.de> <1273528310-7051-2-git-send-email-agraf@suse.de> In-Reply-To: <1273528310-7051-2-git-send-email-agraf@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/2] Add no-op aio emulation stub List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-devel@nongnu.org, hch@lst.de Am 10.05.2010 23:51, schrieb Alexander Graf: > We need to be able to do nothing in AIO fashion. Since I suspect this > could be useful for more cases than the non flushing, I figured I'd > create a new function that does everything AIO-like, but doesn't do > anything. > > Signed-off-by: Alexander Graf > --- > block.c | 18 ++++++++++++++++++ > block.h | 5 +++++ > 2 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/block.c b/block.c > index 48305b7..1cd39d7 100644 > --- a/block.c > +++ b/block.c > @@ -2196,6 +2196,24 @@ static BlockDriverAIOCB *bdrv_aio_flush_em(BlockDriverState *bs, > return &acb->common; > } > > +BlockDriverAIOCB *bdrv_aio_noop_em(BlockDriverState *bs, > + BlockDriverCompletionFunc *cb, void *opaque) > +{ > + BlockDriverAIOCBSync *acb; > + > + acb = qemu_aio_get(&bdrv_em_aio_pool, bs, cb, opaque); > + acb->is_write = 1; /* don't bounce in the completion hadler */ Typo in the comment. > + acb->qiov = NULL; > + acb->bounce = NULL; > + acb->ret = 0; > + > + if (!acb->bh) > + acb->bh = qemu_bh_new(bdrv_aio_bh_cb, acb); > + > + qemu_bh_schedule(acb->bh); > + return &acb->common; > +} > + > /**************************************************************/ > /* sync block device emulation */ > > diff --git a/block.h b/block.h > index f87d24e..bef6358 100644 > --- a/block.h > +++ b/block.h > @@ -33,6 +33,7 @@ typedef struct QEMUSnapshotInfo { > #define BDRV_O_CACHE_WB 0x0040 /* use write-back caching */ > #define BDRV_O_NATIVE_AIO 0x0080 /* use native AIO instead of the thread pool */ > #define BDRV_O_NO_BACKING 0x0100 /* don't open the backing file */ > +#define BDRV_O_NOFLUSH 0x0200 /* don't flush the image ever */ > > #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB) This hunk should be in patch 2/2. > > @@ -97,6 +98,10 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, > BlockDriverCompletionFunc *cb, void *opaque); > void bdrv_aio_cancel(BlockDriverAIOCB *acb); > > +/* Emulate a no-op */ > +BlockDriverAIOCB *bdrv_aio_noop_em(BlockDriverState *bs, > + BlockDriverCompletionFunc *cb, void *opaque); > + > typedef struct BlockRequest { > /* Fields to be filled by multiwrite caller */ > int64_t sector; I think exporting this function shouldn't be necessary. Everything that deals with AIO emulation should be contained in block.c. Kevin