On Thu, Aug 12, 2021 at 05:07:10PM +0100, Matthew Wilcox wrote: > On Wed, Aug 11, 2021 at 02:07:51PM +0100, David Howells wrote: > > (*) Can page_endio() be split into two separate functions, one for read > > and one for write? If seems a waste of time to conditionally switch > > between two different branches. > > At this point I'm thinking ... > > static inline void folio_end_read(struct folio *folio, int err) > { > if (!err) > folio_set_uptodate(folio); > folio_unlock(folio); > } > > Clearly the page isn't uptodate at this point, or ->readpage wouldn't've > been called. So there's no need to clear it. And PageError is > completely useless. Just opencoding the above makes a lot more sense. No need to turn err into some acceptable form, and trivial to follow. Not all little convenience helpers are good. > > } > > > > - *_page = page; > > + *_page = &folio->page; > > Can't do anything about this one; the write_begin API needs to be fixed. It actually needs to go away. There's not real good use for that level of API. netfs should just open code the releavant parts of generic_perform_write, similar to iomap.