Linux EXT4 FS development
 help / color / mirror / Atom feed
From: "Fengnan Chang" <changfengnan@bytedance.com>
To: <brauner@kernel.org>, <djwong@kernel.org>, <hch@infradead.org>,
	 <ojaswin@linux.ibm.com>, <dgc@kernel.org>,
	<linux-xfs@vger.kernel.org>,  <linux-fsdevel@vger.kernel.org>,
	<linux-ext4@vger.kernel.org>,  <linux-kernel@vger.kernel.org>,
	<lidiangang@bytedance.com>,  <pankaj.raghav@linux.dev>
Cc: "Fengnan Chang" <changfengnan@bytedance.com>
Subject: [PATCH v5 2/4] iomap: factor out iomap_dio_bio_release_pages helper
Date: Mon, 29 Jun 2026 20:01:22 +0800	[thread overview]
Message-ID: <20260629120124.25223-3-changfengnan@bytedance.com> (raw)
In-Reply-To: <20260629120124.25223-1-changfengnan@bytedance.com>

Extract bio page-release logic from __iomap_dio_bio_end_io() into a
helper taking (bio, dio_flags, error) so the upcoming simple direct I/O
path can reuse it without a struct iomap_dio.

No functional change.

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
 fs/iomap/direct-io.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 487c4763f3fde..c40350cdf3b14 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -237,23 +237,29 @@ static void iomap_dio_done(struct iomap_dio *dio)
 	iomap_dio_complete_work(&dio->aio.work);
 }
 
-static void __iomap_dio_bio_end_io(struct bio *bio, bool inline_completion)
+static inline void iomap_dio_bio_release_pages(struct bio *bio,
+		unsigned int dio_flags, bool error)
 {
-	struct iomap_dio *dio = bio->bi_private;
-
 	if (bio_integrity(bio))
 		fs_bio_integrity_free(bio);
 
-	if (dio->flags & IOMAP_DIO_BOUNCE) {
-		bio_iov_iter_unbounce(bio, !!dio->error,
-				dio->flags & IOMAP_DIO_USER_BACKED);
+	if (dio_flags & IOMAP_DIO_BOUNCE) {
+		bio_iov_iter_unbounce(bio, error,
+				dio_flags & IOMAP_DIO_USER_BACKED);
 		bio_put(bio);
-	} else if (dio->flags & IOMAP_DIO_USER_BACKED) {
+	} else if (dio_flags & IOMAP_DIO_USER_BACKED) {
 		bio_check_pages_dirty(bio);
 	} else {
 		bio_release_pages(bio, false);
 		bio_put(bio);
 	}
+}
+
+static void __iomap_dio_bio_end_io(struct bio *bio, bool inline_completion)
+{
+	struct iomap_dio *dio = bio->bi_private;
+
+	iomap_dio_bio_release_pages(bio, dio->flags, !!dio->error);
 
 	/* Do not touch bio below, we just gave up our reference. */
 
-- 
2.39.5 (Apple Git-154)

  parent reply	other threads:[~2026-06-29 12:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 12:01 [PATCH v5 0/4] iomap: add simple dio path for small direct I/O Fengnan Chang
2026-06-29 12:01 ` [PATCH v5 1/4] iomap: factor out iomap_dio_alignment helper Fengnan Chang
2026-06-30  6:13   ` Christoph Hellwig
2026-06-29 12:01 ` Fengnan Chang [this message]
2026-06-30  6:17   ` [PATCH v5 2/4] iomap: factor out iomap_dio_bio_release_pages helper Christoph Hellwig
2026-06-29 12:01 ` [PATCH v5 3/4] iomap: pass error code to should_report_dio_fserror directly Fengnan Chang
2026-06-30  6:18   ` Christoph Hellwig
2026-06-29 12:01 ` [PATCH v5 4/4] iomap: add simple dio path for small direct I/O Fengnan Chang
2026-06-30 11:48   ` Christoph Hellwig
2026-07-01  3:21     ` changfengnan

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=20260629120124.25223-3-changfengnan@bytedance.com \
    --to=changfengnan@bytedance.com \
    --cc=brauner@kernel.org \
    --cc=dgc@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=lidiangang@bytedance.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=pankaj.raghav@linux.dev \
    /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