On Tue, Jun 17, 2025 at 3:55 AM Christoph Hellwig <hch@xxxxxx> wrote: > > Add inode and wpc fields to pass the inode and writeback context that > are needed in the entire writeback call chain, and let the callers > initialize all fields in the writeback context before calling > iomap_writepages to simplify the argument passing. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Joanne Koong <joannelkoong@xxxxxxxxx> > --- > block/fops.c | 8 +++++-- > fs/gfs2/aops.c | 8 +++++-- > fs/iomap/buffered-io.c | 52 +++++++++++++++++++----------------------- > fs/xfs/xfs_aops.c | 24 +++++++++++++------ > fs/zonefs/file.c | 8 +++++-- > include/linux/iomap.h | 6 ++--- > 6 files changed, 61 insertions(+), 45 deletions(-) > > diff --git a/block/fops.c b/block/fops.c > index 1309861d4c2c..3394263d942b 100644 > --- a/block/fops.c > +++ b/block/fops.c > @@ -558,9 +558,13 @@ static const struct iomap_writeback_ops blkdev_writeback_ops = { > static int blkdev_writepages(struct address_space *mapping, > struct writeback_control *wbc) > { > - struct iomap_writepage_ctx wpc = { }; > + struct iomap_writepage_ctx wpc = { > + .inode = mapping->host, > + .wbc = wbc, > + .ops = &blkdev_writeback_ops Would it be worth defining the writeback ops inside the wpc struct as well instead of having that be in a separate "static const struct iomap_writeback_ops" definition outside the function? imo it makes it easier to follow to just have everything listed in one place > + }; > > - return iomap_writepages(mapping, wbc, &wpc, &blkdev_writeback_ops); > + return iomap_writepages(&wpc); > }