Commit 8eb7e2d0 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: kill REQ_F_TIMEOUT_NOSEQ

There are too many useless flags, kill REQ_F_TIMEOUT_NOSEQ, which can be
easily infered from req.timeout itself.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a1a46616
...@@ -532,7 +532,6 @@ enum { ...@@ -532,7 +532,6 @@ enum {
REQ_F_NOWAIT_BIT, REQ_F_NOWAIT_BIT,
REQ_F_LINK_TIMEOUT_BIT, REQ_F_LINK_TIMEOUT_BIT,
REQ_F_ISREG_BIT, REQ_F_ISREG_BIT,
REQ_F_TIMEOUT_NOSEQ_BIT,
REQ_F_COMP_LOCKED_BIT, REQ_F_COMP_LOCKED_BIT,
REQ_F_NEED_CLEANUP_BIT, REQ_F_NEED_CLEANUP_BIT,
REQ_F_OVERFLOW_BIT, REQ_F_OVERFLOW_BIT,
...@@ -575,8 +574,6 @@ enum { ...@@ -575,8 +574,6 @@ enum {
REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT), REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT),
/* regular file */ /* regular file */
REQ_F_ISREG = BIT(REQ_F_ISREG_BIT), REQ_F_ISREG = BIT(REQ_F_ISREG_BIT),
/* no timeout sequence */
REQ_F_TIMEOUT_NOSEQ = BIT(REQ_F_TIMEOUT_NOSEQ_BIT),
/* completion under lock */ /* completion under lock */
REQ_F_COMP_LOCKED = BIT(REQ_F_COMP_LOCKED_BIT), REQ_F_COMP_LOCKED = BIT(REQ_F_COMP_LOCKED_BIT),
/* needs cleanup */ /* needs cleanup */
...@@ -1010,6 +1007,11 @@ static void io_ring_ctx_ref_free(struct percpu_ref *ref) ...@@ -1010,6 +1007,11 @@ static void io_ring_ctx_ref_free(struct percpu_ref *ref)
complete(&ctx->ref_comp); complete(&ctx->ref_comp);
} }
static inline bool io_is_timeout_noseq(struct io_kiocb *req)
{
return !req->timeout.off;
}
static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
{ {
struct io_ring_ctx *ctx; struct io_ring_ctx *ctx;
...@@ -1222,7 +1224,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) ...@@ -1222,7 +1224,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx)
struct io_kiocb *req = list_first_entry(&ctx->timeout_list, struct io_kiocb *req = list_first_entry(&ctx->timeout_list,
struct io_kiocb, list); struct io_kiocb, list);
if (req->flags & REQ_F_TIMEOUT_NOSEQ) if (io_is_timeout_noseq(req))
break; break;
if (req->timeout.target_seq != ctx->cached_cq_tail if (req->timeout.target_seq != ctx->cached_cq_tail
- atomic_read(&ctx->cq_timeouts)) - atomic_read(&ctx->cq_timeouts))
...@@ -5087,8 +5089,7 @@ static int io_timeout(struct io_kiocb *req) ...@@ -5087,8 +5089,7 @@ static int io_timeout(struct io_kiocb *req)
* timeout event to be satisfied. If it isn't set, then this is * timeout event to be satisfied. If it isn't set, then this is
* a pure timeout request, sequence isn't used. * a pure timeout request, sequence isn't used.
*/ */
if (!off) { if (io_is_timeout_noseq(req)) {
req->flags |= REQ_F_TIMEOUT_NOSEQ;
entry = ctx->timeout_list.prev; entry = ctx->timeout_list.prev;
goto add; goto add;
} }
...@@ -5103,7 +5104,7 @@ static int io_timeout(struct io_kiocb *req) ...@@ -5103,7 +5104,7 @@ static int io_timeout(struct io_kiocb *req)
list_for_each_prev(entry, &ctx->timeout_list) { list_for_each_prev(entry, &ctx->timeout_list) {
struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list);
if (nxt->flags & REQ_F_TIMEOUT_NOSEQ) if (io_is_timeout_noseq(nxt))
continue; continue;
/* nxt.seq is behind @tail, otherwise would've been completed */ /* nxt.seq is behind @tail, otherwise would've been completed */
if (off >= nxt->timeout.target_seq - tail) if (off >= nxt->timeout.target_seq - tail)
......
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