From: David Sterba <dsterba@suse.cz>
To: Tal Zussman <tz2294@columbia.edu>
Cc: David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
Qu Wenruo <wqu@suse.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/7] btrfs: convert heuristic_collect_sample() to use folios
Date: Wed, 9 Sep 2026 03:26:33 +0200 [thread overview]
Message-ID: <20260909012633.GI9053@suse.cz> (raw)
In-Reply-To: <20260907-btrfs-folio-conversions-v2-5-b5fe79f7607b@columbia.edu>
On Mon, Sep 07, 2026 at 04:19:59PM -0400, Tal Zussman wrote:
> Convert the sampling loop to folios. This removes the last caller of
> find_get_page() in btrfs and saves a call to compound_head() per sampled
> page. Document that the lookup is not supposed to fail with an ASSERT().
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>
> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
> ---
> fs/btrfs/compression.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 979b2ffbd8fc..fa8b92592321 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -1488,7 +1488,7 @@ static bool sample_repeated_patterns(struct heuristic_ws *ws)
> static void heuristic_collect_sample(struct inode *inode, u64 start, u64 end,
> struct heuristic_ws *ws)
> {
> - struct page *page;
> + struct folio *folio;
> pgoff_t index, index_end;
> u32 i, curr_sample_pos;
> u8 *in_data;
> @@ -1514,8 +1514,10 @@ static void heuristic_collect_sample(struct inode *inode, u64 start, u64 end,
>
> curr_sample_pos = 0;
> while (index < index_end) {
> - page = find_get_page(inode->i_mapping, index);
> - in_data = kmap_local_page(page);
> + folio = filemap_get_folio(inode->i_mapping, index);
> + ASSERT(!IS_ERR(folio));
> + in_data = kmap_local_folio(folio,
> + offset_in_folio(folio, (u64)index << PAGE_SHIFT));
It would be better to avoid the cast, this is source of subtle errors so
we try to avoid that. With demise of 32bit architectures it's less of a
problem because index (pgoff_t) is 64 bit type but still.
Please insert a patch that changes the type of index and index_end to
u64, we initialize them from a u64 type anyway and we know the value
fits to pgoff_t (as argument to filemap_get_folio()).
next prev parent reply other threads:[~2026-09-09 1:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 20:19 [PATCH v2 0/7] btrfs: convert some struct page users to folios Tal Zussman
2026-09-07 20:19 ` [PATCH v2 1/7] btrfs: tests: rename process_page_range() to process_folio_range() Tal Zussman
2026-09-07 20:19 ` [PATCH v2 2/7] btrfs: tests: convert test_find_delalloc() to use folios Tal Zussman
2026-09-09 4:56 ` Qu Wenruo
2026-09-07 20:19 ` [PATCH v2 3/7] btrfs: tests: use eb folio helpers in extent buffer memory checks Tal Zussman
2026-09-07 20:19 ` [PATCH v2 4/7] btrfs: convert btrfs_compr_pool_scan() to use folios Tal Zussman
2026-09-07 20:19 ` [PATCH v2 5/7] btrfs: convert heuristic_collect_sample() " Tal Zussman
2026-09-09 1:26 ` David Sterba [this message]
2026-09-09 4:25 ` Tal Zussman
2026-09-07 20:20 ` [PATCH v2 6/7] btrfs: fix stale function references in compression comments Tal Zussman
2026-09-07 20:20 ` [PATCH v2 7/7] btrfs: use folios for reading super blocks from the block device Tal Zussman
2026-09-09 6:10 ` [PATCH v2 0/7] btrfs: convert some struct page users to folios Qu Wenruo
2026-09-09 14:03 ` David Sterba
2026-09-09 17:30 ` Tal Zussman
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=20260909012633.GI9053@suse.cz \
--to=dsterba@suse.cz \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=tz2294@columbia.edu \
--cc=willy@infradead.org \
--cc=wqu@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.