: Add paio_submit_len() non sector sized AIO
Subsystems (2)
PATCH 3/5 : Add paio_submit_len() non sector sized AIO
From: Nicholas Bellinger <[email protected]>
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.
--- block/raw-posix-aio.h | 3 +++ posix-aio-compat.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-)
block/raw-posix-aio.h +3 -0
@@ -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);
posix-aio-compat.c +28 -0
@@ -585,6 +585,34 @@ 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)
Signature · 1 line
1.5.6.5
Quoted 5 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds posix-aio-compat.c:paio_submit_len(), which is a identical to
paio_submit()expect that in expectednb_leninstead ofnb_sectors(* 512) so that it can be used by BSG AIO for write()/read() of structsg_io_v4.
Jusre remove the nb_sectors argument, we already get the length passed in the iovec.
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds posix-aio-compat.c:paio_submit_len(), which is a identical to
paio_submit()expect that in expectednb_leninstead ofnb_sectors(* 512) so that it can be used by BSG AIO for write()/read() of structsg_io_v4.Jusre remove the
nb_sectorsargument, we already get the length passed in the iovec.
Mmmm, should this stay in a seperate paio_submit_len() function..? Or would it be preferred to calculate struct qemu_paiocb->aio_nbytes from the passed iov[i].iov_len for the BlockDriverState->sg == BDS_BSG case..?
Best,
--nab