Linux-XFS Archive mirror
 help / color / mirror / Atom feed
* [PATCH] iomap: convert iomap_writepages to writeack_iter
@ 2024-04-12  6:16 Christoph Hellwig
  2024-04-12 15:34 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-04-12  6:16 UTC (permalink / raw
  To: brauner; +Cc: djwong, linux-xfs, linux-fsdevel

This removes one indirect function call per folio, and adds type safety
by not casting through a void pointer.

Based on a patch by Matthew Wilcox.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap/buffered-io.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 4e8e41c8b3c0e4..e09441f4fceb6f 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1958,18 +1958,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
 	return error;
 }
 
-static int iomap_do_writepage(struct folio *folio,
-		struct writeback_control *wbc, void *data)
-{
-	return iomap_writepage_map(data, wbc, folio);
-}
-
 int
 iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
 		struct iomap_writepage_ctx *wpc,
 		const struct iomap_writeback_ops *ops)
 {
-	int			ret;
+	struct folio *folio = NULL;
+	int error;
 
 	/*
 	 * Writeback from reclaim context should never happen except in the case
@@ -1980,8 +1975,9 @@ iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
 		return -EIO;
 
 	wpc->ops = ops;
-	ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc);
-	return iomap_submit_ioend(wpc, ret);
+	while ((folio = writeback_iter(mapping, wbc, folio, &error)))
+		error = iomap_writepage_map(wpc, wbc, folio);
+	return iomap_submit_ioend(wpc, error);
 }
 EXPORT_SYMBOL_GPL(iomap_writepages);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iomap: convert iomap_writepages to writeack_iter
  2024-04-12  6:16 [PATCH] iomap: convert iomap_writepages to writeack_iter Christoph Hellwig
@ 2024-04-12 15:34 ` Darrick J. Wong
  2024-04-12 19:11 ` Mike Snitzer
  2024-04-15 12:26 ` [PATCH] " Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2024-04-12 15:34 UTC (permalink / raw
  To: Christoph Hellwig; +Cc: brauner, linux-xfs, linux-fsdevel, Matthew Wilcox

[adding willy to cc just in case he sees something I didn't]

On Fri, Apr 12, 2024 at 08:16:14AM +0200, Christoph Hellwig wrote:
> This removes one indirect function call per folio, and adds type safety
> by not casting through a void pointer.
> 
> Based on a patch by Matthew Wilcox.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks like a straightforward conversion to me...
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/iomap/buffered-io.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 4e8e41c8b3c0e4..e09441f4fceb6f 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -1958,18 +1958,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
>  	return error;
>  }
>  
> -static int iomap_do_writepage(struct folio *folio,
> -		struct writeback_control *wbc, void *data)
> -{
> -	return iomap_writepage_map(data, wbc, folio);
> -}
> -
>  int
>  iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
>  		struct iomap_writepage_ctx *wpc,
>  		const struct iomap_writeback_ops *ops)
>  {
> -	int			ret;
> +	struct folio *folio = NULL;
> +	int error;
>  
>  	/*
>  	 * Writeback from reclaim context should never happen except in the case
> @@ -1980,8 +1975,9 @@ iomap_writepages(struct address_space *mapping, struct writeback_control *wbc,
>  		return -EIO;
>  
>  	wpc->ops = ops;
> -	ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc);
> -	return iomap_submit_ioend(wpc, ret);
> +	while ((folio = writeback_iter(mapping, wbc, folio, &error)))
> +		error = iomap_writepage_map(wpc, wbc, folio);
> +	return iomap_submit_ioend(wpc, error);
>  }
>  EXPORT_SYMBOL_GPL(iomap_writepages);
>  
> -- 
> 2.39.2
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: iomap: convert iomap_writepages to writeack_iter
  2024-04-12  6:16 [PATCH] iomap: convert iomap_writepages to writeack_iter Christoph Hellwig
  2024-04-12 15:34 ` Darrick J. Wong
@ 2024-04-12 19:11 ` Mike Snitzer
  2024-04-15 12:26 ` [PATCH] " Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Snitzer @ 2024-04-12 19:11 UTC (permalink / raw
  To: Christoph Hellwig; +Cc: brauner, djwong, linux-xfs, linux-fsdevel

FYI, noticed a typo in the subject: s/writeack_iter/writeback_iter/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iomap: convert iomap_writepages to writeack_iter
  2024-04-12  6:16 [PATCH] iomap: convert iomap_writepages to writeack_iter Christoph Hellwig
  2024-04-12 15:34 ` Darrick J. Wong
  2024-04-12 19:11 ` Mike Snitzer
@ 2024-04-15 12:26 ` Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2024-04-15 12:26 UTC (permalink / raw
  To: Christoph Hellwig; +Cc: Christian Brauner, djwong, linux-xfs, linux-fsdevel

On Fri, 12 Apr 2024 08:16:14 +0200, Christoph Hellwig wrote:
> This removes one indirect function call per folio, and adds type safety
> by not casting through a void pointer.
> 
> Based on a patch by Matthew Wilcox.
> 
> 

Applied to the vfs.iomap branch of the vfs/vfs.git tree.
Patches in the vfs.iomap branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.iomap

[1/1] iomap: convert iomap_writepages to writeack_iter
      https://git.kernel.org/vfs/vfs/c/0fac04e4e0ea

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-15 12:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12  6:16 [PATCH] iomap: convert iomap_writepages to writeack_iter Christoph Hellwig
2024-04-12 15:34 ` Darrick J. Wong
2024-04-12 19:11 ` Mike Snitzer
2024-04-15 12:26 ` [PATCH] " Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).