aio: add support for having user mapped iocbs
authorJens Axboe <axboe@kernel.dk>
Tue, 4 Dec 2018 16:50:14 +0000 (09:50 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Dec 2018 16:50:14 +0000 (09:50 -0700)
commit99c5bb2b9dffef1dec0b6f37d2fc4eca7c3dc195
tree532bc56674c3198377cb739c76448e87cd9058a8
parent96d38553b45a45ab0ea7a92b22fc8e95fe20295b
aio: add support for having user mapped iocbs

For io_submit(), we have to first copy each pointer to an iocb, then
copy the iocb. The latter is 64 bytes in size, and that's a lot of
copying for a single IO.

Add support for setting IOCTX_FLAG_USERIOCB through the new io_setup2()
system call, which allows the iocbs to reside in userspace. If this flag
is used, then io_submit() doesn't take pointers to iocbs anymore, it
takes an index value into the array of iocbs instead. Similary, for
io_getevents(), the iocb ->obj will be the index, not the pointer to the
iocb.

See the change made to fio to support this feature, it's pretty
trivialy to adapt to. For applications, like fio, that previously
embedded the iocb inside a application private structure, some sort
of lookup table/structure is needed to find the private IO structure
from the index at io_getevents() time.

http://git.kernel.dk/cgit/fio/commit/?id=3c3168e91329c83880c91e5abc28b9d6b940fd95

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/aio.c
include/uapi/linux/aio_abi.h