From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43512 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLAts-0000YD-KC for qemu-devel@nongnu.org; Wed, 24 Nov 2010 03:40:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLAtr-0007Kb-HD for qemu-devel@nongnu.org; Wed, 24 Nov 2010 03:40:24 -0500 Received: from nm2-vm0.bullet.mail.ne1.yahoo.com ([98.138.91.39]:38749) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PLAtr-0007KU-5z for qemu-devel@nongnu.org; Wed, 24 Nov 2010 03:40:23 -0500 From: "Nicholas A. Bellinger" Date: Wed, 24 Nov 2010 00:40:20 -0800 Message-Id: <1290588020-8912-1-git-send-email-nab@linux-iscsi.org> Subject: [Qemu-devel] [PATCH 3/5] block: Add paio_submit_len() non sector sized AIO List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hannes Reinecke , Kevin Wolf Cc: qemu-devel , Stefan Hajnoczi , Gerd Hoffmann , Nicholas Bellinger , Paolo Bonzini From: Nicholas Bellinger This patch adds posix-aio-compat.c:paio_submit_len(), which is a identical to paio_submit() expect that in expected nb_len instead of nb_sectors (* 512) so that it can be used by BSG AIO for write()/read() of struct sg_io_v4. Signed-off-by: Nicholas A. Bellinger --- block/raw-posix-aio.h | 3 +++ posix-aio-compat.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/block/raw-posix-aio.h b/block/raw-posix-aio.h index dfc63b8..8028d5b 100644 --- a/block/raw-posix-aio.h +++ b/block/raw-posix-aio.h @@ -30,6 +30,9 @@ int paio_init(void); BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, int type); +BlockDriverAIOCB *paio_submit_len(BlockDriverState *bs, int fd, + int64_t sector_num, QEMUIOVector *qiov, int nb_len, + BlockDriverCompletionFunc *cb, void *opaque, int type); BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque); diff --git a/posix-aio-compat.c b/posix-aio-compat.c index 0704064..df9efb7 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -588,6 +588,35 @@ BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, return &acb->common; } +BlockDriverAIOCB *paio_submit_len(BlockDriverState *bs, int fd, + int64_t sector_num, QEMUIOVector *qiov, int nb_len, + BlockDriverCompletionFunc *cb, void *opaque, int type) +{ + struct qemu_paiocb *acb; + + acb = qemu_aio_get(&raw_aio_pool, bs, cb, opaque); + if (!acb) + return NULL; + + acb->aio_type = type; + acb->aio_fildes = fd; + acb->ev_signo = SIGUSR2; + acb->async_context_id = get_async_context_id(); + + if (qiov) { + acb->aio_iov = qiov->iov; + acb->aio_niov = qiov->niov; + } + acb->aio_nbytes = nb_len; + acb->aio_offset = 0; + + acb->next = posix_aio_state->first_aio; + posix_aio_state->first_aio = acb; + + qemu_paio_submit(acb); + return &acb->common; +} + BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) -- 1.5.6.5