Skip to content

Commit

Permalink
iomap: convert iomap_writepages to writeack_iter
Browse files Browse the repository at this point in the history
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 <hch@lst.de>
Link: https://lore.kernel.org/r/20240412061614.1511629-1-hch@lst.de
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Christoph Hellwig authored and Christian Brauner committed Apr 15, 2024
1 parent 4cece76 commit 0fac04e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions fs/iomap/buffered-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1958,18 +1958,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
return error;
}

static int iomap_do_writepage(struct folio *folio,
struct writeback_control *wbc, void *data)
{
return iomap_writepage_map(data, wbc, folio);
}

int
iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
struct iomap_writepage_ctx *wpc,
const struct iomap_writeback_ops *ops)
{
int ret;
struct folio *folio = NULL;
int error;

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

wpc->ops = ops;
ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc);
return iomap_submit_ioend(wpc, ret);
while ((folio = writeback_iter(mapping, wbc, folio, &error)))
error = iomap_writepage_map(wpc, wbc, folio);
return iomap_submit_ioend(wpc, error);
}
EXPORT_SYMBOL_GPL(iomap_writepages);

Expand Down

0 comments on commit 0fac04e

Please sign in to comment.