Rename from iomap_read_folio_sync() to iomap_bio_read_folio_sync() to indicate the dependency on the block io layer and add a CONFIG_BLOCK check to have iomap_bio_read_folio_sync() return -ENOSYS if the caller calls this in environments where CONFIG_BLOCK is not set. Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> --- fs/iomap/buffered-io-bio.c | 2 +- fs/iomap/buffered-io.c | 2 +- fs/iomap/internal.h | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/iomap/buffered-io-bio.c b/fs/iomap/buffered-io-bio.c index 24f5ede7af3d..c1132ff4a502 100644 --- a/fs/iomap/buffered-io-bio.c +++ b/fs/iomap/buffered-io-bio.c @@ -10,7 +10,7 @@ #include "internal.h" -int iomap_read_folio_sync(loff_t block_start, struct folio *folio, +int iomap_bio_read_folio_sync(loff_t block_start, struct folio *folio, size_t poff, size_t plen, const struct iomap *iomap) { struct bio_vec bvec; diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 47e27459da4d..227cbd9a3e9e 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -702,7 +702,7 @@ static int __iomap_write_begin(const struct iomap_iter *iter, size_t len, if (iter->flags & IOMAP_NOWAIT) return -EAGAIN; - status = iomap_read_folio_sync(block_start, folio, + status = iomap_bio_read_folio_sync(block_start, folio, poff, plen, srcmap); if (status) return status; diff --git a/fs/iomap/internal.h b/fs/iomap/internal.h index 2fc1796053da..9efdbf82795e 100644 --- a/fs/iomap/internal.h +++ b/fs/iomap/internal.h @@ -26,10 +26,15 @@ u32 iomap_finish_ioend_direct(struct iomap_ioend *ioend); bool ifs_set_range_uptodate(struct folio *folio, struct iomap_folio_state *ifs, size_t off, size_t len); int iomap_submit_ioend(struct iomap_writepage_ctx *wpc, int error); -int iomap_read_folio_sync(loff_t block_start, struct folio *folio, size_t poff, - size_t plen, const struct iomap *iomap); int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, struct writeback_control *wbc, struct folio *folio, struct inode *inode, loff_t pos, loff_t end_pos, unsigned len); +#ifdef CONFIG_BLOCK +int iomap_bio_read_folio_sync(loff_t block_start, struct folio *folio, + size_t poff, size_t plen, const struct iomap *iomap); +#else +#define iomap_bio_read_folio_sync(...) (-ENOSYS) +#endif /* CONFIG_BLOCK */ + #endif /* _IOMAP_INTERNAL_H */ -- 2.47.1