Skip to content

Commit 3d20024

Browse files
committed
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>
1 parent e7637a4 commit 3d20024

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

fs/io_uring.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ static const struct io_op_def io_op_defs[] = {
10581058
[IORING_OP_NOP] = {
10591059
.audit_skip = 1,
10601060
.iopoll = 1,
1061+
.buffer_select = 1,
10611062
},
10621063
[IORING_OP_READV] = {
10631064
.needs_file = 1,
@@ -4538,7 +4539,17 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags)
45384539
*/
45394540
static int io_nop(struct io_kiocb *req, unsigned int issue_flags)
45404541
{
4541-
__io_req_complete(req, issue_flags, 0, 0);
4542+
void __user *buf;
4543+
4544+
if (req->flags & REQ_F_BUFFER_SELECT) {
4545+
size_t len = 1;
4546+
4547+
buf = io_buffer_select(req, &len, issue_flags);
4548+
if (IS_ERR(buf))
4549+
return PTR_ERR(buf);
4550+
}
4551+
4552+
__io_req_complete(req, issue_flags, 0, io_put_kbuf(req, issue_flags));
45424553
return 0;
45434554
}
45444555

0 commit comments

Comments
 (0)