Commit 8a72758c authored by Jens Axboe's avatar Jens Axboe

io_uring: mark requests that we can do poll async in io_op_defs

Add a pollin/pollout field to the request table, and have commands that
we can safely poll for properly marked.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b41e9852
...@@ -629,6 +629,9 @@ struct io_op_def { ...@@ -629,6 +629,9 @@ struct io_op_def {
unsigned file_table : 1; unsigned file_table : 1;
/* needs ->fs */ /* needs ->fs */
unsigned needs_fs : 1; unsigned needs_fs : 1;
/* set if opcode supports polled "wait" */
unsigned pollin : 1;
unsigned pollout : 1;
}; };
static const struct io_op_def io_op_defs[] = { static const struct io_op_def io_op_defs[] = {
...@@ -638,6 +641,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -638,6 +641,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollin = 1,
}, },
[IORING_OP_WRITEV] = { [IORING_OP_WRITEV] = {
.async_ctx = 1, .async_ctx = 1,
...@@ -645,6 +649,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -645,6 +649,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_file = 1, .needs_file = 1,
.hash_reg_file = 1, .hash_reg_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollout = 1,
}, },
[IORING_OP_FSYNC] = { [IORING_OP_FSYNC] = {
.needs_file = 1, .needs_file = 1,
...@@ -652,11 +657,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -652,11 +657,13 @@ static const struct io_op_def io_op_defs[] = {
[IORING_OP_READ_FIXED] = { [IORING_OP_READ_FIXED] = {
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollin = 1,
}, },
[IORING_OP_WRITE_FIXED] = { [IORING_OP_WRITE_FIXED] = {
.needs_file = 1, .needs_file = 1,
.hash_reg_file = 1, .hash_reg_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollout = 1,
}, },
[IORING_OP_POLL_ADD] = { [IORING_OP_POLL_ADD] = {
.needs_file = 1, .needs_file = 1,
...@@ -672,6 +679,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -672,6 +679,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.needs_fs = 1, .needs_fs = 1,
.pollout = 1,
}, },
[IORING_OP_RECVMSG] = { [IORING_OP_RECVMSG] = {
.async_ctx = 1, .async_ctx = 1,
...@@ -679,6 +687,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -679,6 +687,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.needs_fs = 1, .needs_fs = 1,
.pollin = 1,
}, },
[IORING_OP_TIMEOUT] = { [IORING_OP_TIMEOUT] = {
.async_ctx = 1, .async_ctx = 1,
...@@ -690,6 +699,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -690,6 +699,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.file_table = 1, .file_table = 1,
.pollin = 1,
}, },
[IORING_OP_ASYNC_CANCEL] = {}, [IORING_OP_ASYNC_CANCEL] = {},
[IORING_OP_LINK_TIMEOUT] = { [IORING_OP_LINK_TIMEOUT] = {
...@@ -701,6 +711,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -701,6 +711,7 @@ static const struct io_op_def io_op_defs[] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollout = 1,
}, },
[IORING_OP_FALLOCATE] = { [IORING_OP_FALLOCATE] = {
.needs_file = 1, .needs_file = 1,
...@@ -729,11 +740,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -729,11 +740,13 @@ static const struct io_op_def io_op_defs[] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollin = 1,
}, },
[IORING_OP_WRITE] = { [IORING_OP_WRITE] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollout = 1,
}, },
[IORING_OP_FADVISE] = { [IORING_OP_FADVISE] = {
.needs_file = 1, .needs_file = 1,
...@@ -745,11 +758,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -745,11 +758,13 @@ static const struct io_op_def io_op_defs[] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollout = 1,
}, },
[IORING_OP_RECV] = { [IORING_OP_RECV] = {
.needs_mm = 1, .needs_mm = 1,
.needs_file = 1, .needs_file = 1,
.unbound_nonreg_file = 1, .unbound_nonreg_file = 1,
.pollin = 1,
}, },
[IORING_OP_OPENAT2] = { [IORING_OP_OPENAT2] = {
.needs_file = 1, .needs_file = 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment