Re: [PATCH v3 03/16] iomap: refactor the writeback interface

Darrick J. Wong
2025-07-03T16:51:18Z

On Thu, Jul 03, 2025 at 02:16:54PM +0200, Christoph Hellwig wrote:
> On Wed, Jul 02, 2025 at 10:13:53AM -0700, Darrick J. Wong wrote:
> > > + int (*writeback_range)(struct iomap_writepage_ctx *wpc,
> > > + struct folio *folio, u64 pos, unsigned int len, u64 end_pos);
> >
> > Why does @pos change from loff_t to u64 here? Are we expecting
> > filesystems that set FOP_UNSIGNED_OFFSET?
>
> It doesn't really change, it matches what iomap_writepage_map_blocks
> was doing. I guess it simply doesn't fix the existing inconsistency.
>
> > > + int (*submit_ioend)(struct iomap_writepage_ctx *wpc, int status);
> >
> > Nit: ^^ indenting change here.
>
> Yeah, RST formatting is a mess unfortunately. I think the problem is
> that the exiting code uses 4 space indents. I wonder if that's required
> by %##% RST?

It's a code block, so it's not going to make the rst parser choke.
However it will result in an weirdly indented output:

struct iomap_writeback_ops {
int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode,
loff_t offset, unsigned len);
int (*submit_ioend)(struct iomap_writepage_ctx *wpc, int status);
void (*discard_folio)(struct folio *folio, loff_t pos);
};

is what I got when I removed an indentation space from discard_folio.
Hilariously it actually makes the "(" line up which appeals to my column
aligning brain and actually looks better. :P

So having now seriously undercut my own point, I'll relax to "meh do
whatever".

> > > + if (wpc->iomap.type != IOMAP_HOLE)
> > > + *wb_pending = true;
> >
> > /me wonders if this should be an outparam of ->writeback_range to signal
> > that it actually added the folio to the writeback ioend chain? Or maybe
> > just a boolean in iomap_writepage_ctx that we clear before calling
> > ->writeback_range and iomap_add_to_ioend can set it as appropriate?
>
> What's the benefit of that? A hole pretty clearly signal there is
> no writeback here.

Fair enough. In my head it was "the code that actually sets up the
ioend should set this flag" but I guess we can detect it from the
mapping after the fact instead of passing things around.

> > Should this jump label should be named add_to_ioend or something? We
> > already mapped the blocks. The same applies to the zoned version of
> > this function.
>
> The newer version already uses a map_blocks helper for both again.

Ah, so it does.

--D