summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-05-20syscall: fix names of __NR_* macrosDmitry V. Levin
Rename __NR_sys_io_uring* to __NR_io_uring* to match kernel headers. The prefix traditionally used for macros describing syscall numbers is "__NR_", not "__NR_sys_". Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-19Match const signatures in io_uring_prep_* to native functionsIan Gulliver
io_uring_prep_{readv,writev,read_fixed,write_fixed}() take non-const arguments that are const in the native functions that they mimic. Make those arguments const. Signed-off-by: Ian Gulliver <git@flamingcow.io>
2019-05-18Fix liburing.h memset() missing declarationIan Gulliver
liburing.h uses memset() but doesn't include string.h. If nothing else includes it, this causes compile errors. Add the include. Signed-off-by: Ian Gulliver <git@flamingcow.io>
2019-05-18io_uring.h: sync with kernelJens Axboe
Add sync_range_file opcode and related fields, and the io_uring_register(2) commands for eventfd registration. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-13Add link SQE supportJens Axboe
Just a basic test case that does various forms of linked nops, and a sample bare bones copy program using linked reads and writes. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-06liburing: add extern "C" to liburing.hKevin Vigor
Make header includable from C++ projects. Signed-off-by: Kevin Vigor <kvigor@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-06liburing: do not build static library with -fPICKevin Vigor
Static libraries are generally built without -fPIC for slight performance gain, make that the case for liburing. Signed-off-by: Kevin Vigor <kvigor@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-06liburing: improve 'make install'Kevin Vigor
'make install' did not install all the headers necessary to use the library; fix. Additionally allow specifying the install prefix, which was previously hardcoded to /usr. Signed-off-by: Kevin Vigor <kvigor@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-18Rename completion helpersJens Axboe
We have io_uring_get_sqe() on the submission side, yet the completion side is named _completion. Rename as follows: io_uring_get_completion() io_uring_peek_cqe() iO_uring_wait_completion() io_uring_wait_cqe() This better tells the user what the _get variant does by calling it _peek instead, and we move to using _cqe() as the postfix instead of _completion. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-17Add io_uring_cqe_seen()Jens Axboe
There's a failure case where an application gets a cqe entry, but the kernel can then overwrite it before the application is done reading it. This can happen since the io_uring_{get,wait}_completion() interface both returns a CQE pointer AND increments the ring index. If the kernel reuses this entry before the applications is done reading it, the contents may be corrupted. Remove the CQ head increment from the CQE retrieval, and put it into a separate helper, io_uring_cqe_seen(). The application must call this helper when it got a new CQE entry through one of the above calls, and it's now done reading it. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-11test/nop: add NOP test caseJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-10test/fsync: update for IOSQE_IO_DRAIN approachJens Axboe
I generalized the barrier flag to be applicable to all commands, so let's drop the fsync special flag. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-07Add io_uring_cqe_get_data()Zach Bjornson
Signed-off-by: Zach Bjornson <zbbjornson@gmail.com> Add uintptr_t cast to avoid 32-bit warnings. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-06Add barrier fsync test caseJens Axboe
Also changes the fsync prep helper to require passing in the actual flag, not just a boolean for fsync vs fdatasync. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-19Remove IOCQE_FLAG_CACHEHITJens Axboe
This cache hint has been removed from the io_uring series, as there's some hesitation to leak this information to userspace. Remove it from the header file and the man page. We can always re-introduce it later, if we get some variant of this included. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-13queue: ensure io_uring_submit() returns the system call valueJens Axboe
A previous fix that ensured we pass back the right error messed up the normal return, which is number of entries submitted. This makes the poll test cases fail. Fixes: 8260029608b9 ("queue: ensure io_uring_submit() returns the right error") Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-05queue: ensure io_uring_submit() returns the right errorJens Axboe
We weren't passing back -errno for the system call failure. This meant any error got turned into EPERM as far as the caller was concerned. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-28Add read/write fixed prep supportJens Axboe
Also unify the setup, all the read/write variants can use the same helper. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-15src/queue: kill bogus ktail_next == head checkJens Axboe
This really wants to be a "will we over-fill the ring?" kind of check, but the sqe_head/sqe_tail should not be that far apart. If they are, that's a bug elsewhere. So just kill the check. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-10Sync io_uring.h with the kernelJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-10src/queue: add comments on the read and write barriersJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08test/fsync: add simple fsync testerJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08add io_uring_queue_mmapJeff Moyer
io_uring_queue_init does not allow the caller to specify sq_thread_cpu or sq_thread_idle. Users that want to specify those parameters need to call io_uring_setup(2) themselves. Add a helper so that they don't also have to hand-craft the code to map the submission and completion queues, and setup the sqe ring. This allows those applications to still make use of io_uring_submit and get/wait_completion. Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08io_uring_enter: don't expose sigset_size argumentJens Axboe
Applications should not need to care about this, we can pass it in ourselves. Once the libc support is there, we won't expose this parameter either. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08Add sigmask parameter to io_uring_enterJeff Moyer
Update liburing and io_uring_enter.2 to match the kernel. Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08syscall: update io_uring_enter() to match kernel typeJens Axboe
We would randomly fail depending on what garbage was passed in the two sigset related fields. Reported-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-05io_uring_register takes 4 argsJeff Moyer
Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-31src/io_uring.h: sync with kernel headerJens Axboe
Just a removal of the IORING_MAX_ENTRIES user visible define. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-29Update kernel io_uring headerJens Axboe
- struct io_uring_params changed (u16 -> u32 for sq options) - Use unsigned for the flag types Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-23System calls have been renumberedJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18Switch to IORING_OP_POLL_ADD/REMOVEJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17Split src/io_uring.c upJens Axboe
Let's have the various helpers be in usefully named functions, no need to bundle them all into the same one. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17liburing: ensure prep helpers actually set iovec countJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17Add sqe prep helpersJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17Update POLL APIJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17Add test case for IORING_OP_POLLJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-16Update barriers for x86/x86-64Jens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-16Sync with upstream APIJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-15Add configure scriptJens Axboe
Some older installs don't have __kernel_rwf_t in linux/fs.h, so add a check for that. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-13Add x86 32-bit supportJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-13io_uring_get_iocb() -> io_uring_get_sqe()Jens Axboe
Missed this part when the switch was made to full 'sqe'. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-13Sync io_uring.h with the kernelJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-11Sync with kernel APIJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-10io_queue_init: pass in flags, not io_uring_paramsJens Axboe
We don't need any of the information in there in the caller, and this makes it harder to abuse as we don't require the caller to have memset() the struct first. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-10Update to newer APIJens Axboe
- Fixed buffers are now available through io_uring_register() - Various thread/wq options are now dead and automatic instead - sqe->index is now sqe->buf_index - Fixed buffers require flag, not separate opcode Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-10Update APIJens Axboe
- io_uring_sqe added a data field that's passed back at completion - io_uring_sqe added an index field, for fixed buffer locations - io_uring_setup(2) system call added a 'nr_iovecs' field Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-09Update to newer APIJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-08liburing: include the ring fd in the io_uringJens Axboe
No point in keeping these separate. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-08Change API to provide io_uring struct abstractionJens Axboe
This is cleaner than having the app juggle an SQ and CQ ring, just wrap them in struct io_uring and have the API always take that. This means the app doesn't need to worry about the different types of rings, and that we only need to pass in one argument for setup/teardown. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-08liburing: add io_uring_iocb_from_ev() helperJens Axboe
Returns the iocb associated with a completion event. Signed-off-by: Jens Axboe <axboe@kernel.dk>