io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: [PATCH 7/7] io_uring: do poll's hash_node init in common code
Date: Sun, 18 Oct 2020 10:17:43 +0100	[thread overview]
Message-ID: <a2a03d41d389ccddb174e645d5b0e93a979bbf6f.1603011899.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1603011899.git.asml.silence@gmail.com>

Move INIT_HLIST_NODE(&req->hash_node) into __io_arm_poll_handler(), so
that it doesn't duplicated and common poll code would be responsible for
it.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 81b0b38ee506..95d2bb7069c6 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5096,6 +5096,7 @@ static __poll_t __io_arm_poll_handler(struct io_kiocb *req,
 	struct io_ring_ctx *ctx = req->ctx;
 	bool cancel = false;
 
+	INIT_HLIST_NODE(&req->hash_node);
 	io_init_poll_iocb(poll, mask, wake_func);
 	poll->file = req->file;
 	poll->wait.private = req;
@@ -5157,7 +5158,6 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
 
 	req->flags |= REQ_F_POLLED;
 	req->apoll = apoll;
-	INIT_HLIST_NODE(&req->hash_node);
 
 	mask = 0;
 	if (def->pollin)
@@ -5350,7 +5350,6 @@ static int io_poll_add(struct io_kiocb *req)
 	struct io_poll_table ipt;
 	__poll_t mask;
 
-	INIT_HLIST_NODE(&req->hash_node);
 	ipt.pt._qproc = io_poll_queue_proc;
 
 	mask = __io_arm_poll_handler(req, &req->poll, &ipt, poll->events,
-- 
2.24.0


  parent reply	other threads:[~2020-10-18  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18  9:17 [PATCH for-5.10 0/7] another pack of random cleanups Pavel Begunkov
2020-10-18  9:17 ` [PATCH 1/7] io_uring: flags-based creds init in queue Pavel Begunkov
2020-10-18  9:17 ` [PATCH 2/7] io_uring: kill ref get/drop in personality init Pavel Begunkov
2020-10-18  9:17 ` [PATCH 3/7] io_uring: inline io_fail_links() Pavel Begunkov
2020-10-18  9:17 ` [PATCH 4/7] io_uring: make cached_cq_overflow non atomic_t Pavel Begunkov
2020-10-18  9:17 ` [PATCH 5/7] io_uring: remove extra ->file check in poll prep Pavel Begunkov
2020-10-18  9:17 ` [PATCH 6/7] io_uring: inline io_poll_task_handler() Pavel Begunkov
2020-10-18  9:17 ` Pavel Begunkov [this message]
2020-10-20 14:10 ` [PATCH for-5.10 0/7] another pack of random cleanups 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=a2a03d41d389ccddb174e645d5b0e93a979bbf6f.1603011899.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).