projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c854357
)
io_uring: refactor io_get_sequence()
author
Pavel Begunkov
<asml.silence@gmail.com>
Thu, 17 Jun 2021 17:14:05 +0000
(18:14 +0100)
committer
Jens Axboe
<axboe@kernel.dk>
Fri, 18 Jun 2021 15:22:02 +0000
(09:22 -0600)
Clean up io_get_sequence() and add a comment describing the magic around
sequence correction.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link:
https://lore.kernel.org/r/f55dc409936b8afa4698d24b8677a34d31077ccb.1623949695.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
patch
|
blob
|
history
diff --git
a/fs/io_uring.c
b/fs/io_uring.c
index
474705a
..
c41e9a9
100644
(file)
--- a/
fs/io_uring.c
+++ b/
fs/io_uring.c
@@
-5993,13
+5993,12
@@
static int io_req_prep_async(struct io_kiocb *req)
static u32 io_get_sequence(struct io_kiocb *req)
{
- struct io_kiocb *pos;
- struct io_ring_ctx *ctx = req->ctx;
- u32 nr_reqs = 0;
+ u32 seq = req->ctx->cached_sq_head;
- io_for_each_link(pos, req)
- nr_reqs++;
- return ctx->cached_sq_head - nr_reqs;
+ /* need original cached_sq_head, but it was increased for each req */
+ io_for_each_link(req, req)
+ seq--;
+ return seq;
}
static bool io_drain_req(struct io_kiocb *req)