From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 07/12] io_uring: refactor io_get_sequence()
Date: Thu, 17 Jun 2021 18:14:05 +0100 [thread overview]
Message-ID: <f55dc409936b8afa4698d24b8677a34d31077ccb.1623949695.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
Clean up io_get_sequence() and add a comment describing the magic around
sequence correction.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 98932f3786d5..54838cdb2536 100644
--- 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)
--
2.31.1
next prev parent reply other threads:[~2021-06-17 17:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 17:13 [PATCH for-next 00/12] another round of 5.14 optimisations Pavel Begunkov
2021-06-17 17:13 ` [PATCH 01/12] io_uring: fix false WARN_ONCE Pavel Begunkov
2021-06-17 17:14 ` [PATCH 02/12] io_uring: refactor io_submit_flush_completions() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 03/12] io_uring: move creds from io-wq work to io_kiocb Pavel Begunkov
2021-06-17 17:14 ` [PATCH 04/12] io_uring: track request creds with a flag Pavel Begunkov
2021-06-17 17:14 ` [PATCH 05/12] io_uring: simplify iovec freeing in io_clean_op() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 06/12] io_uring: clean all flags in io_clean_op() at once Pavel Begunkov
2021-06-17 17:14 ` Pavel Begunkov [this message]
2021-06-17 17:14 ` [PATCH 08/12] io_uring: inline __tctx_task_work() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 09/12] io_uring: optimise task_work submit flushing Pavel Begunkov
2021-06-17 17:14 ` [PATCH 10/12] io_uring: refactor tctx task_work list splicing Pavel Begunkov
2021-06-17 17:14 ` [PATCH 11/12] io_uring: don't resched with empty task_list Pavel Begunkov
2021-06-17 17:14 ` [PATCH 12/12] io_uring: improve in tctx_task_work() resubmission Pavel Begunkov
2021-06-18 15:23 ` Jens Axboe
2021-06-18 15:33 ` Pavel Begunkov
2021-06-18 15:35 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f55dc409936b8afa4698d24b8677a34d31077ccb.1623949695.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox