Re: [Cluster-devel] [PATCH v5 5/9] iomap/gfs2: Get page in page_prepare handler

2023-01-08 Thread Christoph Hellwig
> + if (page_ops && page_ops->page_prepare) > + folio = page_ops->page_prepare(iter, pos, len); > + else > + folio = iomap_get_folio(iter, pos); > + if (IS_ERR(folio)) > return PTR_ERR(folio); I'd love to have a iomap_get_folio helper for this

Re: [Cluster-devel] [PATCH v5 6/9] iomap: Rename page_prepare handler to get_folio

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig although it might make sense to just do the rename in patch 5 which changes the signature to return a folio?

Re: [Cluster-devel] [PATCH v5 2/9] iomap/gfs2: Unlock and put folio in page_done handler

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: [Cluster-devel] [PATCH v5 7/9] iomap/xfs: Eliminate the iomap_valid handler

2023-01-08 Thread Andreas Gruenbacher
On Sun, Jan 8, 2023 at 6:32 PM Christoph Hellwig wrote: > On Wed, Jan 04, 2023 at 07:08:17PM +, Matthew Wilcox wrote: > > On Wed, Jan 04, 2023 at 09:53:17AM -0800, Darrick J. Wong wrote: > > > I wonder if this should be reworked a bit to reduce indenting: > > > > > > if (PTR_ERR(folio) ==

Re: [Cluster-devel] [PATCH v5 9/9] xfs: Make xfs_iomap_folio_ops static

2023-01-08 Thread Christoph Hellwig
On Sat, Dec 31, 2022 at 04:09:19PM +0100, Andreas Gruenbacher wrote: > Variable xfs_iomap_folio_ops isn't used outside xfs_iomap.c, so it > should be static. Looks good: Reviewed-by: Christoph Hellwig

Re: [Cluster-devel] [PATCH v5 8/9] iomap: Rename page_ops to folio_ops

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: [Cluster-devel] [PATCH v5 7/9] iomap/xfs: Eliminate the iomap_valid handler

2023-01-08 Thread Christoph Hellwig
On Wed, Jan 04, 2023 at 07:08:17PM +, Matthew Wilcox wrote: > On Wed, Jan 04, 2023 at 09:53:17AM -0800, Darrick J. Wong wrote: > > I wonder if this should be reworked a bit to reduce indenting: > > > > if (PTR_ERR(folio) == -ESTALE) { > > FYI this is a bad habit to be in. The compiler

Re: [Cluster-devel] [PATCH v5 1/9] iomap: Add iomap_put_folio helper

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: [Cluster-devel] [PATCH v5 4/9] iomap: Add iomap_get_folio helper

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: [Cluster-devel] [RFC v6 04/10] iomap: Add iomap_get_folio helper

2023-01-08 Thread Dave Chinner
On Sun, Jan 08, 2023 at 08:40:28PM +0100, Andreas Gruenbacher wrote: > Add an iomap_get_folio() helper that gets a folio reference based on > an iomap iterator and an offset into the address space. Use it in > iomap_write_begin(). > > Signed-off-by: Andreas Gruenbacher > Reviewed-by: Darrick J.

[Cluster-devel] [RFC v6 05/10] iomap/gfs2: Get page in page_prepare handler

2023-01-08 Thread Andreas Gruenbacher
Change the iomap ->page_prepare() handler to get and return a locked folio instead of doing that in iomap_write_begin(). This allows to recover from out-of-memory situations in ->page_prepare(), which eliminates the corresponding error handling code in iomap_write_begin(). The ->put_folio()

[Cluster-devel] [RFC v6 07/10] iomap: Rename page_prepare handler to get_folio

2023-01-08 Thread Andreas Gruenbacher
The ->page_prepare() handler in struct iomap_page_ops is now somewhat misnamed, so rename it to ->get_folio(). Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/gfs2/bmap.c | 6 +++--- fs/iomap/buffered-io.c | 4 ++--

[Cluster-devel] [RFC v6 09/10] iomap: Rename page_ops to folio_ops

2023-01-08 Thread Andreas Gruenbacher
The operations in struct page_ops all operate on folios, so rename struct page_ops to struct folio_ops. Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/gfs2/bmap.c | 4 ++-- fs/iomap/buffered-io.c | 12 ++--

[Cluster-devel] [RFC v6 08/10] iomap/xfs: Eliminate the iomap_valid handler

2023-01-08 Thread Andreas Gruenbacher
Eliminate the ->iomap_valid() handler by switching to a ->get_folio() handler and validating the mapping there. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 26 +- fs/xfs/xfs_iomap.c | 37 ++--- include/linux/iomap.h

[Cluster-devel] [RFC v6 02/10] iomap/gfs2: Unlock and put folio in page_done handler

2023-01-08 Thread Andreas Gruenbacher
When an iomap defines a ->page_done() handler in its page_ops, delegate unlocking the folio and putting the folio reference to that handler. This allows to fix a race between journaled data writes and folio writeback in gfs2: before this change, gfs2_iomap_page_done() was called after unlocking

[Cluster-devel] [RFC v6 04/10] iomap: Add iomap_get_folio helper

2023-01-08 Thread Andreas Gruenbacher
Add an iomap_get_folio() helper that gets a folio reference based on an iomap iterator and an offset into the address space. Use it in iomap_write_begin(). Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 39

[Cluster-devel] [RFC v6 03/10] iomap: Rename page_done handler to put_folio

2023-01-08 Thread Andreas Gruenbacher
The ->page_done() handler in struct iomap_page_ops is now somewhat misnamed in that it mainly deals with unlocking and putting a folio, so rename it to ->put_folio(). Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/gfs2/bmap.c | 4

[Cluster-devel] [RFC v6 00/10] Turn iomap_page_ops into iomap_folio_ops

2023-01-08 Thread Andreas Gruenbacher
Here's an updated version of this patch queue. Changes since v5 [*]: * A new iomap-internal __iomap_get_folio() helper was added. * The previous iomap-internal iomap_put_folio() helper was renamed to __iomap_put_folio() to mirror __iomap_get_folio(). * The comment describing struct

Re: [Cluster-devel] [PATCH v5 5/9] iomap/gfs2: Get page in page_prepare handler

2023-01-08 Thread Andreas Gruenbacher
On Sun, Jan 8, 2023 at 6:29 PM Christoph Hellwig wrote: > > + if (page_ops && page_ops->page_prepare) > > + folio = page_ops->page_prepare(iter, pos, len); > > + else > > + folio = iomap_get_folio(iter, pos); > > + if (IS_ERR(folio)) > > return

[Cluster-devel] [RFC v6 01/10] iomap: Add __iomap_put_folio helper

2023-01-08 Thread Andreas Gruenbacher
Add an __iomap_put_folio() helper to encapsulate unlocking the folio, calling ->page_done(), and putting the folio. Use the new helper in iomap_write_begin() and iomap_write_end(). This effectively doesn't change the way the code works, but prepares for successive improvements. Signed-off-by:

[Cluster-devel] [RFC v6 06/10] iomap: Add __iomap_get_folio helper

2023-01-08 Thread Andreas Gruenbacher
Add an __iomap_get_folio() helper as the counterpart of the existing __iomap_put_folio() helper. Use the new helper in iomap_write_begin(). Not a functional change. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 16 1 file changed, 12 insertions(+), 4

[Cluster-devel] [RFC v6 10/10] xfs: Make xfs_iomap_folio_ops static

2023-01-08 Thread Andreas Gruenbacher
Variable xfs_iomap_folio_ops isn't used outside xfs_iomap.c, so it should be static. Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_iomap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index

Re: [Cluster-devel] [RFC v6 08/10] iomap/xfs: Eliminate the iomap_valid handler

2023-01-08 Thread Dave Chinner
On Sun, Jan 08, 2023 at 08:40:32PM +0100, Andreas Gruenbacher wrote: > Eliminate the ->iomap_valid() handler by switching to a ->get_folio() > handler and validating the mapping there. > > Signed-off-by: Andreas Gruenbacher I think this is wrong. The ->iomap_valid() function handles a

Re: [Cluster-devel] [PATCH v5 3/9] iomap: Rename page_done handler to put_folio

2023-01-08 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig