All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 3/3] io_uring: have io_file_put() take an io_kiocb rather than the file
Date: Thu, 10 Aug 2023 10:23:46 -0600	[thread overview]
Message-ID: <20230810162346.54872-4-axboe@kernel.dk> (raw)
In-Reply-To: <20230810162346.54872-1-axboe@kernel.dk>

No functional changes in this patch, just a prep patch for needing the
request in io_file_put().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/io_uring.c | 4 ++--
 io_uring/io_uring.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 3da26171599b..138635e66d44 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1004,7 +1004,7 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
 		if (unlikely(req->flags & IO_REQ_CLEAN_FLAGS))
 			io_clean_op(req);
 		if (!(req->flags & REQ_F_FIXED_FILE))
-			io_put_file(req->file);
+			io_put_file(req);
 
 		rsrc_node = req->rsrc_node;
 		/*
@@ -1539,7 +1539,7 @@ void io_free_batch_list(struct io_ring_ctx *ctx, struct io_wq_work_node *node)
 				io_clean_op(req);
 		}
 		if (!(req->flags & REQ_F_FIXED_FILE))
-			io_put_file(req->file);
+			io_put_file(req);
 
 		io_req_put_rsrc_locked(req, ctx);
 
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 12769bad5cee..46643bc9f3c5 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -196,10 +196,10 @@ static inline bool req_has_async_data(struct io_kiocb *req)
 	return req->flags & REQ_F_ASYNC_DATA;
 }
 
-static inline void io_put_file(struct file *file)
+static inline void io_put_file(struct io_kiocb *req)
 {
-	if (file)
-		fput(file);
+	if (req->file)
+		fput(req->file);
 }
 
 static inline void io_ring_submit_unlock(struct io_ring_ctx *ctx,
-- 
2.40.1


  parent reply	other threads:[~2023-08-10 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 16:23 [PATCH for-next 0/3] Misc cleanups Jens Axboe
2023-08-10 16:23 ` [PATCH 1/3] io_uring/fdinfo: get rid of ref tryget Jens Axboe
2023-08-10 16:23 ` [PATCH 2/3] io_uring/splice: use fput() directly Jens Axboe
2023-08-10 16:23 ` Jens Axboe [this message]
2023-08-10 16:29   ` [PATCH 3/3] io_uring: have io_file_put() take an io_kiocb rather than the file 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=20230810162346.54872-4-axboe@kernel.dk \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.