提交 019c2179 编写于 作者: J Jens Axboe 提交者: Xiaoguang Wang

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

to #28170604

commit 8a72758c51f8a5501a0e01ea95069630edb9ca07 upstream

Add a pollin/pollout field to the request table, and have commands that
we can safely poll for properly marked.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 e3d66d1b
...@@ -631,6 +631,9 @@ struct io_op_def { ...@@ -631,6 +631,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[] = {
...@@ -640,6 +643,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -640,6 +643,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,
...@@ -647,6 +651,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -647,6 +651,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,
...@@ -654,11 +659,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -654,11 +659,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,
...@@ -674,6 +681,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -674,6 +681,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,
...@@ -681,6 +689,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -681,6 +689,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,
...@@ -692,6 +701,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -692,6 +701,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] = {
...@@ -703,6 +713,7 @@ static const struct io_op_def io_op_defs[] = { ...@@ -703,6 +713,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,
...@@ -731,11 +742,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -731,11 +742,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,
...@@ -747,11 +760,13 @@ static const struct io_op_def io_op_defs[] = { ...@@ -747,11 +760,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册