From: Kent Overstreet <kent.overstreet@linux.dev>
To: Christoph Hellwig <hch@lst.de>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
linux-bcachefs@vger.kernel.org, ntfs3@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/3] bcachefs: stop using write_cache_pages
Date: Mon, 18 Aug 2025 07:17:15 -0400 [thread overview]
Message-ID: <3zji6rc56egwqvy2gy63aj2wjfo5pyeuq2iikhgudcttdcif2m@dphqqiozruka> (raw)
In-Reply-To: <20250818061017.1526853-3-hch@lst.de>
On Mon, Aug 18, 2025 at 08:10:09AM +0200, Christoph Hellwig wrote:
> 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.
Wouldn't inlining write_cache_pages() achieve the same thing?
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/bcachefs/fs-io-buffered.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
> index 1c54b9b5bd69..fdeaa25189f2 100644
> --- a/fs/bcachefs/fs-io-buffered.c
> +++ b/fs/bcachefs/fs-io-buffered.c
> @@ -655,6 +655,17 @@ static int __bch2_writepage(struct folio *folio,
> return 0;
> }
>
> +static int bch2_write_cache_pages(struct address_space *mapping,
> + struct writeback_control *wbc, void *data)
> +{
> + struct folio *folio = NULL;
> + int error;
> +
> + while ((folio = writeback_iter(mapping, wbc, folio, &error)))
> + error = __bch2_writepage(folio, wbc, data);
> + return error;
> +}
> +
> int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc)
> {
> struct bch_fs *c = mapping->host->i_sb->s_fs_info;
> @@ -663,7 +674,7 @@ int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc
> bch2_inode_opts_get(&w->opts, c, &to_bch_ei(mapping->host)->ei_inode);
>
> blk_start_plug(&w->plug);
> - int ret = write_cache_pages(mapping, wbc, __bch2_writepage, w);
> + int ret = bch2_write_cache_pages(mapping, wbc, w);
> if (w->io)
> bch2_writepage_do_io(w);
> blk_finish_plug(&w->plug);
> --
> 2.47.2
>
next prev parent reply other threads:[~2025-08-18 11:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 6:10 remove write_cache_pages() Christoph Hellwig
2025-08-18 6:10 ` [PATCH 1/3] ntfs3: stop using write_cache_pages Christoph Hellwig
2025-08-18 6:10 ` [PATCH 2/3] bcachefs: " Christoph Hellwig
2025-08-18 11:17 ` Kent Overstreet [this message]
2025-08-19 8:57 ` Christoph Hellwig
2025-08-18 6:10 ` [PATCH 3/3] mm: remove write_cache_pages Christoph Hellwig
2025-08-18 13:18 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3zji6rc56egwqvy2gy63aj2wjfo5pyeuq2iikhgudcttdcif2m@dphqqiozruka \
--to=kent.overstreet@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=hch@lst.de \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ntfs3@lists.linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox