public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: use writeback_iter
@ 2025-04-24  8:27 Christoph Hellwig
  2025-05-02  6:48 ` Christoph Hellwig
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-04-24  8:27 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Use writeback_iter instead of the deprecated write_cache_pages wrapper
in blkdev_writepages.  This removes an indirect call per folio.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/fops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/fops.c b/block/fops.c
index be9f1dbea9ce..f073ef6d3f27 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -451,12 +451,13 @@ static int blkdev_get_block(struct inode *inode, sector_t iblock,
 static int blkdev_writepages(struct address_space *mapping,
 		struct writeback_control *wbc)
 {
+	struct folio *folio = NULL;
 	struct blk_plug plug;
 	int err;
 
 	blk_start_plug(&plug);
-	err = write_cache_pages(mapping, wbc, block_write_full_folio,
-			blkdev_get_block);
+	while ((folio = writeback_iter(mapping, wbc, folio, &err)))
+		err = block_write_full_folio(folio, wbc, blkdev_get_block);
 	blk_finish_plug(&plug);
 
 	return err;
-- 
2.47.2


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

* Re: [PATCH] block: use writeback_iter
  2025-04-24  8:27 [PATCH] block: use writeback_iter Christoph Hellwig
@ 2025-05-02  6:48 ` Christoph Hellwig
  2025-05-02  7:30   ` John Garry
  2025-05-02  7:22 ` Hannes Reinecke
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-05-02  6:48 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Can I get someone to review this mostly trivial patch?


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

* Re: [PATCH] block: use writeback_iter
  2025-04-24  8:27 [PATCH] block: use writeback_iter Christoph Hellwig
  2025-05-02  6:48 ` Christoph Hellwig
@ 2025-05-02  7:22 ` Hannes Reinecke
  2025-05-02  9:10 ` Johannes Thumshirn
  2025-05-02 15:25 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2025-05-02  7:22 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block

On 4/24/25 10:27, Christoph Hellwig wrote:
> Use writeback_iter instead of the deprecated write_cache_pages wrapper
> in blkdev_writepages.  This removes an indirect call per folio.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/fops.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/block/fops.c b/block/fops.c
> index be9f1dbea9ce..f073ef6d3f27 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -451,12 +451,13 @@ static int blkdev_get_block(struct inode *inode, sector_t iblock,
>   static int blkdev_writepages(struct address_space *mapping,
>   		struct writeback_control *wbc)
>   {
> +	struct folio *folio = NULL;
>   	struct blk_plug plug;
>   	int err;
>   
>   	blk_start_plug(&plug);
> -	err = write_cache_pages(mapping, wbc, block_write_full_folio,
> -			blkdev_get_block);
> +	while ((folio = writeback_iter(mapping, wbc, folio, &err)))
> +		err = block_write_full_folio(folio, wbc, blkdev_get_block);
>   	blk_finish_plug(&plug);
>   
>   	return err;

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

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

* Re: [PATCH] block: use writeback_iter
  2025-05-02  6:48 ` Christoph Hellwig
@ 2025-05-02  7:30   ` John Garry
  0 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2025-05-02  7:30 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block

FWIW:

Reviewed-by: John Garry <john.g.garry@oracle.com>

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

* Re: [PATCH] block: use writeback_iter
  2025-04-24  8:27 [PATCH] block: use writeback_iter Christoph Hellwig
  2025-05-02  6:48 ` Christoph Hellwig
  2025-05-02  7:22 ` Hannes Reinecke
@ 2025-05-02  9:10 ` Johannes Thumshirn
  2025-05-02 15:25 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2025-05-02  9:10 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH] block: use writeback_iter
  2025-04-24  8:27 [PATCH] block: use writeback_iter Christoph Hellwig
                   ` (2 preceding siblings ...)
  2025-05-02  9:10 ` Johannes Thumshirn
@ 2025-05-02 15:25 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-05-02 15:25 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block


On Thu, 24 Apr 2025 10:27:52 +0200, Christoph Hellwig wrote:
> Use writeback_iter instead of the deprecated write_cache_pages wrapper
> in blkdev_writepages.  This removes an indirect call per folio.
> 
> 

Applied, thanks!

[1/1] block: use writeback_iter
      commit: 00ef5c728ec05af5f8591016a9d138eab6b6f8e9

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-05-02 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24  8:27 [PATCH] block: use writeback_iter Christoph Hellwig
2025-05-02  6:48 ` Christoph Hellwig
2025-05-02  7:30   ` John Garry
2025-05-02  7:22 ` Hannes Reinecke
2025-05-02  9:10 ` Johannes Thumshirn
2025-05-02 15:25 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox