summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-05-05 21:47:55 -0600
committerJens Axboe <axboe@kernel.dk>2022-05-18 06:12:42 -0600
commit3d200242a6c968af321913b635fc4014b238cba4 (patch)
tree7a82f54ec9edd4fe9db7297d2b6f1983a3ff739e /fs
parente7637a492b9f1ae6b7cfcecf0aed5e4c76efa3bd (diff)
downloadlinux-3d200242a6c968af321913b635fc4014b238cba4.tar.bz2
io_uring: add buffer selection support to IORING_OP_NOP
Obviously not really useful since it's not transferring data, but it is helpful in benchmarking overhead of provided buffers. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2322583f9275..dc129c74ed1e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1058,6 +1058,7 @@ static const struct io_op_def io_op_defs[] = {
[IORING_OP_NOP] = {
.audit_skip = 1,
.iopoll = 1,
+ .buffer_select = 1,
},
[IORING_OP_READV] = {
.needs_file = 1,
@@ -4538,7 +4539,17 @@ done:
*/
static int io_nop(struct io_kiocb *req, unsigned int issue_flags)
{
- __io_req_complete(req, issue_flags, 0, 0);
+ void __user *buf;
+
+ if (req->flags & REQ_F_BUFFER_SELECT) {
+ size_t len = 1;
+
+ buf = io_buffer_select(req, &len, issue_flags);
+ if (IS_ERR(buf))
+ return PTR_ERR(buf);
+ }
+
+ __io_req_complete(req, issue_flags, 0, io_put_kbuf(req, issue_flags));
return 0;
}