Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: stop using write_cache_pages

Stop using the obsolete write_cache_pages and use writeback_iter directly.
This basically just open codes write_cache_pages without the indirect
call, but there's probably ways to structure the code even nicer as a
follow on.

Link: https://lkml.kernel.org/r/20250818061017.1526853-3-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Christoph Hellwig and committed by
Andrew Morton
e34b21ba 8d4bb46b

+12 -1
+12 -1
fs/bcachefs/fs-io-buffered.c
··· 655 655 return 0; 656 656 } 657 657 658 + static int bch2_write_cache_pages(struct address_space *mapping, 659 + struct writeback_control *wbc, void *data) 660 + { 661 + struct folio *folio = NULL; 662 + int error; 663 + 664 + while ((folio = writeback_iter(mapping, wbc, folio, &error))) 665 + error = __bch2_writepage(folio, wbc, data); 666 + return error; 667 + } 668 + 658 669 int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc) 659 670 { 660 671 struct bch_fs *c = mapping->host->i_sb->s_fs_info; ··· 674 663 bch2_inode_opts_get(&w->opts, c, &to_bch_ei(mapping->host)->ei_inode); 675 664 676 665 blk_start_plug(&w->plug); 677 - int ret = write_cache_pages(mapping, wbc, __bch2_writepage, w); 666 + int ret = bch2_write_cache_pages(mapping, wbc, w); 678 667 if (w->io) 679 668 bch2_writepage_do_io(w); 680 669 blk_finish_plug(&w->plug);