In preparation for calling iomap_add_to_ioend() without a writepage_ctx available, pass in the iomap and the (current) ioend, and return the current ioend. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- fs/iomap/buffered-io.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index c91259530ac1..1bf361446267 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1299,13 +1299,11 @@ static bool iomap_can_add_to_ioend(struct iomap *iomap, * Test to see if we have an existing ioend structure that we could append to * first; otherwise finish off the current ioend and start another. */ -static void -iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, - struct iomap_page *iop, struct iomap_writepage_ctx *wpc, +static struct iomap_ioend *iomap_add_to_ioend(struct inode *inode, + loff_t pos, struct folio *folio, struct iomap_page *iop, + struct iomap *iomap, struct iomap_ioend *ioend, struct writeback_control *wbc, struct list_head *iolist) { - struct iomap *iomap = &wpc->iomap; - struct iomap_ioend *ioend = wpc->ioend; sector_t sector = iomap_sector(iomap, pos); unsigned len = i_blocksize(inode); size_t poff = offset_in_folio(folio, pos); @@ -1314,7 +1312,6 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, if (ioend) list_add(&ioend->io_list, iolist); ioend = iomap_alloc_ioend(inode, iomap, pos, sector, wbc); - wpc->ioend = ioend; } if (!bio_add_folio(ioend->io_bio, folio, len, poff)) { @@ -1326,6 +1323,7 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, atomic_add(len, &iop->write_bytes_pending); ioend->io_size += len; wbc_account_cgroup_owner(wbc, &folio->page, len); + return ioend; } /* @@ -1375,8 +1373,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, continue; if (wpc->iomap.type == IOMAP_HOLE) continue; - iomap_add_to_ioend(inode, pos, folio, iop, wpc, wbc, - &submit_list); + wpc->ioend = iomap_add_to_ioend(inode, pos, folio, iop, + &wpc->iomap, wpc->ioend, wbc, &submit_list); count++; } if (count) -- 2.34.1