From: Chi Zhiling <chizhiling@163.com>
To: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, exfat@lists.linux.dev
Cc: Namjae Jeon <linkinjeon@kernel.org>,
Sungjong Seo <sj1557.seo@samsung.com>,
Yuezhang Mo <yuezhang.mo@sony.com>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Christoph Hellwig <hch@lst.de>,
Chi Zhiling <chizhiling@kylinos.cn>
Subject: [PATCH v3 1/8] iomap: export iomap_bio_read_folio_range_sync()
Date: Fri, 16 Oct 2026 11:33:42 +0800 [thread overview]
Message-ID: <20261016033349.3104509-2-chizhiling@163.com> (raw)
In-Reply-To: <20261016033349.3104509-1-chizhiling@163.com>
From: Chi Zhiling <chizhiling@kylinos.cn>
Filesystems that provide a buffered write ->read_folio_range handler
need to perform the same synchronous bio read as the default handler.
Move the declaration of iomap_bio_read_folio_range_sync() from the
internal header to <linux/iomap.h>, together with the !CONFIG_BLOCK
fallback, and export it so that modular filesystems can call it.
exfat will call it from its own ->read_folio_range handler to zero
the stale bytes between valid_size and the end of the block under
the folio lock during buffered writes.
Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
---
fs/iomap/bio.c | 1 +
fs/iomap/internal.h | 12 ------------
include/linux/iomap.h | 9 +++++++++
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/fs/iomap/bio.c b/fs/iomap/bio.c
index 48100c614431..abb649f024a3 100644
--- a/fs/iomap/bio.c
+++ b/fs/iomap/bio.c
@@ -187,3 +187,4 @@ int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
bio_uninit(&bio);
return error;
}
+EXPORT_SYMBOL_GPL(iomap_bio_read_folio_range_sync);
diff --git a/fs/iomap/internal.h b/fs/iomap/internal.h
index 74e898b196dc..d13aff5e1e91 100644
--- a/fs/iomap/internal.h
+++ b/fs/iomap/internal.h
@@ -20,16 +20,4 @@ static inline size_t iomap_max_bio_size(const struct iomap *iomap)
u32 iomap_finish_ioend_buffered_read(struct iomap_ioend *ioend);
u32 iomap_finish_ioend_direct(struct iomap_ioend *ioend);
-#ifdef CONFIG_BLOCK
-int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
- struct folio *folio, loff_t pos, size_t len);
-#else
-static inline int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
- struct folio *folio, loff_t pos, size_t len)
-{
- WARN_ON_ONCE(1);
- return -EIO;
-}
-#endif /* CONFIG_BLOCK */
-
#endif /* _IOMAP_INTERNAL_H */
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index bc7ae6327dbf..35b686cbb586 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -763,6 +763,8 @@ extern struct bio_set iomap_ioend_bioset;
#ifdef CONFIG_BLOCK
int iomap_bio_read_folio_range(const struct iomap_iter *iter,
struct iomap_read_folio_ctx *ctx, size_t plen);
+int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
+ struct folio *folio, loff_t pos, size_t len);
void iomap_bio_submit_read_endio(const struct iomap_iter *iter,
struct iomap_read_folio_ctx *ctx, bio_end_io_t end_io);
@@ -789,6 +791,13 @@ static inline void iomap_bio_readahead(struct readahead_control *rac,
iomap_readahead(ops, &ctx, NULL);
}
+#else /* !CONFIG_BLOCK */
+static inline int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
+ struct folio *folio, loff_t pos, size_t len)
+{
+ WARN_ON_ONCE(1);
+ return -EIO;
+}
#endif /* CONFIG_BLOCK */
#endif /* LINUX_IOMAP_H */
--
2.53.0
next prev parent reply other threads:[~2026-10-16 3:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 3:33 [PATCH v3 0/8] exfat: fix valid_size update races Chi Zhiling
2026-10-16 3:33 ` Chi Zhiling [this message]
2026-10-16 3:33 ` [PATCH v3 2/8] exfat: zero the invalid tail of the straddle block under the folio lock Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 3/8] exfat: advance valid_size under the folio lock for buffered writes Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 4/8] exfat: advance valid_size while zeroing new ranges Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 5/8] exfat: validate cached iomaps during buffered writes Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 6/8] exfat: drop i_rwsem from exfat_page_mkwrite Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 7/8] exfat: complete direct writes synchronously when they update metadata Chi Zhiling
2026-10-16 3:33 ` [PATCH v3 8/8] exfat: publish i_size and valid_size on direct I/O completion Chi Zhiling
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=20261016033349.3104509-2-chizhiling@163.com \
--to=chizhiling@163.com \
--cc=brauner@kernel.org \
--cc=chizhiling@kylinos.cn \
--cc=djwong@kernel.org \
--cc=exfat@lists.linux.dev \
--cc=hch@lst.de \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=yuezhang.mo@sony.com \
/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
all inboxes | Powered by JetHome®