From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH for-next] io_uring: kill off ios_left
Date: Tue, 24 Aug 2021 15:56:25 +0100 [thread overview]
Message-ID: <c0b70819bc1b6e34e63ec59869303a9611596f5e.1629815641.git.asml.silence@gmail.com> (raw)
->ios_left is only used to decide whether to plug or not, kill it to
avoid this extra accounting, just use the initial submission number.
There is no much difference in regards of enabling plugging, where this
one does it in a few more cases, but all major ones should be covered
well.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 74b606990d7e..54a7868c9c8e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -315,6 +315,7 @@ struct io_submit_state {
unsigned int free_reqs;
bool plug_started;
+ bool need_plug;
/*
* Batch completion logic
@@ -323,8 +324,6 @@ struct io_submit_state {
unsigned int compl_nr;
/* inline/task_work completion list, under ->uring_lock */
struct list_head free_list;
-
- unsigned int ios_left;
};
struct io_ring_ctx {
@@ -6715,10 +6714,10 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
* Plug now if we have more than 1 IO left after this, and the target
* is potentially a read/write to block based storage.
*/
- if (!state->plug_started && state->ios_left > 1 &&
- io_op_defs[req->opcode].plug) {
+ if (state->need_plug && io_op_defs[req->opcode].plug) {
blk_start_plug(&state->plug);
state->plug_started = true;
+ state->need_plug = false;
}
if (io_op_defs[req->opcode].needs_file) {
@@ -6727,8 +6726,6 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
if (unlikely(!req->file))
ret = -EBADF;
}
-
- state->ios_left--;
return ret;
}
@@ -6816,7 +6813,7 @@ static void io_submit_state_start(struct io_submit_state *state,
unsigned int max_ios)
{
state->plug_started = false;
- state->ios_left = max_ios;
+ state->need_plug = max_ios > 2;
/* set only head, no need to init link_last in advance */
state->link.head = NULL;
}
--
2.32.0
reply other threads:[~2021-08-24 14:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c0b70819bc1b6e34e63ec59869303a9611596f5e.1629815641.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