[RFC PATCH] afs: Stop implementing ->writepage()

Christoph Hellwig hch at lst.de
Sun Nov 20 23:17:04 PST 2022


On Fri, Nov 18, 2022 at 10:37:35AM +0000, David Howells wrote:
> A hint flag is added to the writeback_control struct so that a filesystem
> can say that the write is triggered by write_begin seeing a conflicting
> write.  This causes do_writepages() to do a single pass of the loop only.

Not a huge fan of that, especially as write_begin is not really a
method, but just an awkward hook in legacy write implementations.

I'd much rather have a private pointer in the writeback_control and
make the behavior implementation specific.  It will need to be split
into a separate patch with proper documentation and a CC to linux-mm.

>  (1) afs_write_back_from_locked_folio() could be called directly rather
>      than calling filemap_fdatawrite_wbc(), but that would avoid the
>      control group stuff that wbc_attach_and_unlock_inode() and co. seem to
>      do.  Do I actually need to do this?

That would be much preferred over the for_write_begin hack, given that
write_begin really isn't a well defined method but a hacky hook for
legacy write implementations.

>  (2) afs_writepages_region() has a loop in it to generate multiple writes.
>      do_writepages() also acquired a loop[2] which will also generate
>      multiple writes.  Should I remove the loop from
>      afs_writepages_region() and leave it to the caller of ->writepages()?

Dropping out of ->writpages inside a page does seem a bit problematic,
so you probably want to keep the loop.




More information about the linux-afs mailing list