diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-12-21 17:02:57 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-12-21 17:47:06 +0100 |
commit | d293b1a89694fc4918d9a4330a71ba2458f9d581 (patch) | |
tree | c901f0e6a81018d4eeb4d44dd8c73944bb6fb5ea /io_uring/register.c | |
parent | io_uring/rw: ensure io->bytes_done is always initialized (diff) | |
download | linux-d293b1a89694fc4918d9a4330a71ba2458f9d581.tar.xz linux-d293b1a89694fc4918d9a4330a71ba2458f9d581.zip |
io_uring/kbuf: add method for returning provided buffer ring head
The tail of the provided ring buffer is shared between the kernel and
the application, but the head is private to the kernel as the
application doesn't need to see it. However, this also prevents the
application from knowing how many buffers the kernel has consumed.
Usually this is fine, as the information is inherently racy in that
the kernel could be consuming buffers continually, but for cleanup
purposes it may be relevant to know how many buffers are still left
in the ring.
Add IORING_REGISTER_PBUF_STATUS which will return status for a given
provided buffer ring. Right now it just returns the head, but space
is reserved for more information later in, if needed.
Link: https://github.com/axboe/liburing/discussions/1020
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/register.c')
-rw-r--r-- | io_uring/register.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/io_uring/register.c b/io_uring/register.c index a4286029e920..708dd1d89add 100644 --- a/io_uring/register.c +++ b/io_uring/register.c @@ -542,6 +542,12 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, break; ret = io_register_file_alloc_range(ctx, arg); break; + case IORING_REGISTER_PBUF_STATUS: + ret = -EINVAL; + if (!arg || nr_args != 1) + break; + ret = io_register_pbuf_status(ctx, arg); + break; default: ret = -EINVAL; break; |