block: use writeback_iter
authorChristoph Hellwig <hch@lst.de>
Thu, 24 Apr 2025 08:27:52 +0000 (10:27 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 2 May 2025 15:23:00 +0000 (09:23 -0600)
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>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20250424082752.1967679-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/fops.c

index 82b672d15ea4f8500e847b9cbe2229abc99c083e..b6d7cdd96b54b85076db7d9431a8818b102b1389 100644 (file)
@@ -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;