public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ming Lei <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected],
	Pavel Begunkov <[email protected]>,
	Kevin Wolf <[email protected]>, Ming Lei <[email protected]>
Subject: [RFC PATCH V2 4/9] io_uring: move marking REQ_F_CQE_SKIP out of io_free_req()
Date: Tue,  7 May 2024 00:22:40 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Prepare for supporting sqe group, which requires to post group leader's
CQE after all members' CQEs are posted. For group leader request, we can't
do that in io_req_complete_post, and REQ_F_CQE_SKIP can't be set in
io_free_req().

So move marking REQ_F_CQE_SKIP out of io_free_req().

No functional change.

Signed-off-by: Ming Lei <[email protected]>
---
 io_uring/io_uring.c | 5 +++--
 io_uring/timeout.c  | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index e4be930e0f1e..c184c9a312df 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1027,8 +1027,6 @@ __cold void io_free_req(struct io_kiocb *req)
 {
 	/* refs were already put, restore them for io_req_task_complete() */
 	req->flags &= ~REQ_F_REFCOUNT;
-	/* we only want to free it, don't post CQEs */
-	req->flags |= REQ_F_CQE_SKIP;
 	req->io_task_work.func = io_req_task_complete;
 	io_req_task_work_add(req);
 }
@@ -1797,6 +1795,9 @@ struct io_wq_work *io_wq_free_work(struct io_wq_work *work)
 	if (req_ref_put_and_test(req)) {
 		if (req->flags & IO_REQ_LINK_FLAGS)
 			nxt = io_req_find_next(req);
+
+		/* we have posted CQEs in io_req_complete_post() */
+		req->flags |= REQ_F_CQE_SKIP;
 		io_free_req(req);
 	}
 	return nxt ? &nxt->work : NULL;
diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index 1c9bf07499b1..202f540aa314 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -47,6 +47,9 @@ static inline void io_put_req(struct io_kiocb *req)
 {
 	if (req_ref_put_and_test(req)) {
 		io_queue_next(req);
+
+		/* we only want to free it, don't post CQEs */
+		req->flags |= REQ_F_CQE_SKIP;
 		io_free_req(req);
 	}
 }
-- 
2.42.0


  parent reply	other threads:[~2024-05-06 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 16:22 [RFC PATCH V2 0/9] io_uring: support sqe group and provide group kbuf Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 1/9] io_uring: add io_link_req() helper Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 2/9] io_uring: add io_submit_fail_link() helper Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 3/9] io_uring: add helper of io_req_commit_cqe() Ming Lei
2024-05-06 16:22 ` Ming Lei [this message]
2024-05-06 16:22 ` [RFC PATCH V2 5/9] io_uring: support SQE group Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 6/9] io_uring: support sqe group with members depending on leader Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 7/9] io_uring: support providing sqe group buffer Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 8/9] io_uring/uring_cmd: support provide group kernel buffer Ming Lei
2024-05-06 16:22 ` [RFC PATCH V2 9/9] ublk: support provide io buffer Ming Lei
2024-05-10 14:02 ` [RFC PATCH V2 0/9] io_uring: support sqe group and provide group kbuf Ming Lei

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [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