From: Jens Axboe Date: Fri, 6 May 2022 03:47:55 +0000 (-0600) Subject: io_uring: add buffer selection support to IORING_OP_NOP X-Git-Tag: baikal/aarch64/sdk6.1~4026^2~12 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=8f2af1a5e342e453fd11b7abb2bf54342e708cae;p=kernel.git 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 --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 2322583f92757..dc129c74ed1e5 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; }