path: root/src
AgeCommit message (Collapse)Author
2019-11-06Add test case for IORING_SETUP_CQ_NODROPcqring-nodropJens Axboe
Tests overflows without CQ_NODROP, and correct behavior on a ring setup with CQ_NODROP. The latter backlogs events that otherwise would have been dropped, and returns -EBUSY to an application trying to submit new IO with a backlog pending. Signed-off-by: Jens Axboe <>
2019-11-05barrier.h: add generic smp_mb implementationJeff Moyer
This missing define causes build failures on s390: src/include/liburing.h:298: undefined reference to `io_uring_smp_mb' Signed-off-by: Jeff Moyer <> Signed-off-by: Jens Axboe <>
2019-10-30__io_uring_flush_sq(): remove unnecessary checkKornilios Kourtis
submitted is always going to be non-zero, since we check if head and tail are different at the start of the function. Signed-off-by: Kornilios Kourtis <> Signed-off-by: Jens Axboe <>
2019-10-30sq_ring_needs_enter(): force loading of kflagsKornilios Kourtis
ring->sq.kflags is set by the kernel. Ensure the compiler always loads the value from memory when doing the check. Signed-off-by: Kornilios Kourtis <> Signed-off-by: Jens Axboe <>
2019-10-29Add IORING_OP_ASYNC_CANCEL and prep helperJens Axboe
Signed-off-by: Jens Axboe <>
2019-10-24liburing-0.2liburing-0.2Jens Axboe
Signed-off-by: Jens Axboe <>
2019-10-17Add io_uring_prep_accept() helperJens Axboe
Signed-off-by: Jens Axboe <>
2019-10-17Sync with kernel io_uring.h headerJens Axboe
Signed-off-by: Jens Axboe <>
2019-10-16Add IORING_OP_TIMEOUT_REMOVEJens Axboe
Add the command opcode, and add two test cases for it. Signed-off-by: Jens Axboe <>
2019-10-15Make io_uring_prep_timeout() take timeout flagsJens Axboe
Not in a released version yet, plan for using the flags since we already have the IORING_TIMEOUT_ABS flag. Signed-off-by: Jens Axboe <>
2019-10-15Add test case for absolute timeoutsJens Axboe
Signed-off-by: Jens Axboe <>
2019-10-08Add io_uring_register_files_update()Jens Axboe
Interface to the new file set update functionality. Signed-off-by: Jens Axboe <>
2019-10-04io_uring.h: add IORING_SETUP_CQSIZEJens Axboe
Signed-off-by: Jens Axboe <>
2019-10-04Add io_uring_queue_init_params()Jens Axboe
Like io_uring_queue_init(), but allows passing in the whole parameter structure, not just the flags. Signed-off-by: Jens Axboe <>
2019-10-03Add test/file-registerJens Axboe
Tests both existing functionality, but also the new sparse maps, update/remove/add functionality. Signed-off-by: Jens Axboe <>
2019-10-01Switch to 32/64-bit agnostic timeout formatJens Axboe
We made a kernel change to support timeouts properly on 32-bit archs, update liburing to use __kernel_timespec instead of the differently sized timespec. Signed-off-by: Jens Axboe <>
2019-10-01Fix timeout detectionJens Axboe
We lost the -ETIME return from a previous commit that optimized the exported peek/wait cqe path, make sure that it works again. Fixes: 20c929379461 ("Inline fast-path of io_uring_{wait,peek}_cqe()") Signed-off-by: Jens Axboe <>
2019-09-28Inline fast-path of io_uring_{wait,peek}_cqe()Jens Axboe
For cases where we usually have completions available, it can be fairly costly to always have to call into the liburing library. Ensure that we handle the fast path of finding completions without needing a library call. Signed-off-by: Jens Axboe <>
2019-09-27Fold io_uring_wait_cqes_timeout() with io_uring_wait_cqes()Jens Axboe
We also need the sigset for certain setups, and adding a third option is pretty crazy. Since io_uring_wait_cqes_timeout() isn't in a released version yet (and neither is io_uring_wait_cqes()), make the necessary adjustments. Signed-off-by: Jens Axboe <>
2019-09-27Fix io_uring_wait_cqes_timeout() with ts == NULLJens Axboe
The TIMEOUT command requires a valid timeout set, or we fail. We don't need to arm a timer if we only need to wait for a certain number of requests, so just punt to io_uring_wait_cqes() instead. Signed-off-by: Jens Axboe <>
2019-09-27Add io_uring_wait_cqes()Jens Axboe
Allows to wait for a specific number of CQEs, which can be used more optimally when we can inform the kernel of how many we are waiting for. Calling convention is the same as io_uring_wait_cqe(), we can only return one cqe inline. Signed-off-by: Jens Axboe <>
2019-09-27Add __io_uring_submit_and_wait() helperJens Axboe
Used in two spots, instead of open coding it. Signed-off-by: Jens Axboe <>
2019-09-27io_uring_wait_cqes_timeout: use __io_uring_flush_sq()Jens Axboe
Also pass in correct to_submit and wait_nr. Signed-off-by: Jens Axboe <>
2019-09-27Split up __io_uring_submit()Jens Axboe
It really does two things: 1) Sync internal state with kernel ring on the SQ side 2) Submits the IO Move step 1 to __io_uring_flush_sq(), so we can use them separately from other functions. No intential functional changes in this commit. Signed-off-by: Jens Axboe <> move newer exported symbols to 0.2Jens Axboe
We've added three exported functions since 0.1. We should do the right thing and add them under the next version specifically. Signed-off-by: Jens Axboe <>
2019-09-26io_uring_peek_batch_cqe(): fixup style and add to exportsJens Axboe
Signed-off-by: Jens Axboe <>
2019-09-25Add io_uring_peek_batch_cqe()James Rouzier
io_uring_peek_batch_cqe(), get multiple cqe from the queue at once. Returns the number of cqe gotten. test/cq-peek-batch.c: tests io_uring_peek_batch_cqe() Signed-off-by: James Rouzier <>
2019-09-25Add io_uring_cq_ready()James Rouzier
io_uring_cq_ready(), returns the number of completions that are ready. test/cq-ready.c: tests io_uring_cq_ready Signed-off-by: James Rouzier <>
2019-09-25liburing: use -fPIC for both static and shared librariesJens Axboe
At least for ceph, it fails to statically link with liburing because we don't use -fPIC for the static version of the library. This reverts commit a17aec8458544f5ad3ce234b4750dce35a621081. Signed-off-by: Jens Axboe <>
2019-09-25io_uring.h: sync with kernel headerJens Axboe
Was just missing the sqe->timeout_flags, which are (as of yet) totally unused. Signed-off-by: Jens Axboe <>
2019-09-22Makefile: handle quiet AR/RANLIBJens Axboe
Also unify across subdirs. Signed-off-by: Jens Axboe <>
2019-09-21Makefile: add pretty/quiet CC/LN outputJens Axboe
Signed-off-by: Jens Axboe <>
2019-09-21Add io_uring_wait_cqes_timeout()Jens Axboe
Like io_uring_wait_cqe_timeout(), except this one takes an argument for how many CQEs to ask for when waiting in the kernel. Signed-off-by: Jens Axboe <>
2019-09-21__io_uring_get_cqe: change 'wait' bool to be a count of requestsJens Axboe
Signed-off-by: Jens Axboe <>
2019-09-21io_uring_wait_cqe_timeout: document that io_uring_submit() not neededJens Axboe
We call this internally after queueing the timeout SQE anyway, so the application doesn't have to do it upfront. Signed-off-by: Jens Axboe <>
2019-09-21Merge branch 'sq_space_left' of Axboe
* 'sq_space_left' of Add io_uring_sq_space_left()
2019-09-21io_uring_wait_cqe_timeout: fix wrong error return checkJens Axboe
Fixes: 76e9232baa00 ("Add io_uring_wait_cqe_timeout()") Signed-off-by: Jens Axboe <>
2019-09-21Add io_uring_sq_space_left()James Rouzier
io_uring_sq_space_left(), returns the amount of space left in the submission queue. test/sq-space_left.c tests io_uring_sq_space_left Signed-off-by: James Rouzier <>
2019-09-21Add io_uring_wait_cqe_timeout()Jens Axboe
Like io_uring_wait_cqe(), except it accepts a timeout value as well. Note that an sqe is used internally to handle the timeout. Applications using this function must never set sqe->user_data to LIBURING_UDATA_TIMEOUT! Signed-off-by: Jens Axboe <>
2019-09-20Get rid of memset() for command prep helpersJens Axboe
Also unify all the command prep helpers, so they all use the same core function for setting up the commands. It was a bit hit and miss before this change if it was done manually, or through a helper. Signed-off-by: Jens Axboe <>
2019-09-20Add TIMEOUT supportJens Axboe
Add support for the current TIMEOUT variant. This allows passing in a timeout and event count, first of which will trigger the completion of the timeout command. If the timeout is hit, the command completes with cqe->res == -ETIME. If the asked number of events complete first, the command completes with cqe->res == 0. test/timeout.c tests a variety of timeout conditions. Signed-off-by: Jens Axboe <>
2019-09-19Remove TIMEOUT codeJens Axboe
We'll rework it for the final version, kill the early version test case and liburing addition. This reverts commits: efb39e105afdb4dd5c0f1e964720cfa3cdcceb18 e4269d2c10586c03786df24d6382da99a956f03c 4652762d5be96e08a0ff8194de1e6f6d8127cee5 f102231b0fdbfe8587efda0b24c79a69ee4d8ba7 Signed-off-by: Jens Axboe <>
2019-09-17Add IORING_OP_TIMEOUT opcodeJens Axboe
And associated command prep helper. Signed-off-by: Jens Axboe <>
2019-09-16liburing: add io_uring_prep_{recv,send}msg李通洲
2019-09-06src/setup: unify ring munmap()Jens Axboe
Signed-off-by: Jens Axboe <>
2019-09-06liburing: Use the single mmap featureHristo Venev
Signed-off-by: Hristo Venev <> Signed-off-by: Jens Axboe <>
2019-09-06Sync io_uring.h with the kernelJens Axboe
This brings in the features flags. Signed-off-by: Jens Axboe <>
2019-08-30Fixed address prep helpers should include buf_indexJens Axboe
io_uring depends on the caller specifying the index into the array of registered buffers for doing pre-mapped IO. Make this explicit by requiring the caller to pass in this value for the io_uring_prep_read_fixed() and io_uring_prep_write_fixed() helpers. Signed-off-by: Jens Axboe <>
2019-08-28Make io_uring_peek_cqe() return -EAGAIN for no CQEsJens Axboe
Currently we return 0 if someone calls io_uring_peek_cqe(), but we really should be returning 0 only if we managed to find a completion entry. Return -EAGAIN to notify the caller that no entries are there. Signed-off-by: Jens Axboe <>
2019-08-20liburing/barrier.h: Add prefix to arm barriersJulia Suvorova
Rename the newly added arm barriers and READ/WRITE_ONCE to avoid using popular names. Signed-off-by: Julia Suvorova <> Signed-off-by: Jens Axboe <>