Skip to content

Commit 0fac04e

Browse files
Christoph Hellwigbrauner
authored andcommitted
iomap: convert iomap_writepages to writeack_iter
This removes one indirect function call per folio, and adds type safety by not casting through a void pointer. Based on a patch by Matthew Wilcox. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 4cece76 commit 0fac04e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

fs/iomap/buffered-io.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,18 +1958,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
19581958
return error;
19591959
}
19601960

1961-
static int iomap_do_writepage(struct folio *folio,
1962-
struct writeback_control *wbc, void *data)
1963-
{
1964-
return iomap_writepage_map(data, wbc, folio);
1965-
}
1966-
19671961
int
19681962
iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
19691963
struct iomap_writepage_ctx *wpc,
19701964
const struct iomap_writeback_ops *ops)
19711965
{
1972-
int ret;
1966+
struct folio *folio = NULL;
1967+
int error;
19731968

19741969
/*
19751970
* Writeback from reclaim context should never happen except in the case
@@ -1980,8 +1975,9 @@ iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
19801975
return -EIO;
19811976

19821977
wpc->ops = ops;
1983-
ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc);
1984-
return iomap_submit_ioend(wpc, ret);
1978+
while ((folio = writeback_iter(mapping, wbc, folio, &error)))
1979+
error = iomap_writepage_map(wpc, wbc, folio);
1980+
return iomap_submit_ioend(wpc, error);
19851981
}
19861982
EXPORT_SYMBOL_GPL(iomap_writepages);
19871983

0 commit comments

Comments
 (0)