Rename from iomap_add_to_ioend() to iomap_bio_add_to_ioend() to indicate the dependency on the block io layer and add a CONFIG_BLOCK check to have iomap_bio_add_to_ioend() 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 | 4 ++-- fs/iomap/internal.h | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io-bio.c b/fs/iomap/buffered-io-bio.c index c1132ff4a502..798cb59dbbf4 100644 --- a/fs/iomap/buffered-io-bio.c +++ b/fs/iomap/buffered-io-bio.c @@ -126,7 +126,7 @@ static bool iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t pos, * At the end of a writeback pass, there will be a cached ioend remaining on the * writepage context that the caller will need to submit. */ -int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, +int iomap_bio_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) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 227cbd9a3e9e..b7b7222a1700 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1571,8 +1571,8 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc, case IOMAP_HOLE: break; default: - error = iomap_add_to_ioend(wpc, wbc, folio, inode, pos, - end_pos, map_len); + error = iomap_bio_add_to_ioend(wpc, wbc, folio, inode, + pos, end_pos, map_len); if (!error) (*count)++; break; diff --git a/fs/iomap/internal.h b/fs/iomap/internal.h index 9efdbf82795e..7fa3114c5d16 100644 --- a/fs/iomap/internal.h +++ b/fs/iomap/internal.h @@ -26,15 +26,16 @@ 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_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); +int iomap_bio_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); #else #define iomap_bio_read_folio_sync(...) (-ENOSYS) +#define iomap_bio_add_to_ioend(...) (-ENOSYS) #endif /* CONFIG_BLOCK */ #endif /* _IOMAP_INTERNAL_H */ -- 2.47.1