From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
linux-btrfs@vger.kernel.org
Subject: [RFC PATCH v2 16/22] btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT
Date: Wed, 2 Dec 2026 03:15:19 +0000 [thread overview]
Message-ID: <20261202031533.1665444-17-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261202031533.1665444-1-ericcurtin17@gmail.com>
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE and PAGE_SHIFT are
not compile-time constants.
Check BTRFS_MAX_FOLIO_SIZE against PAGE_SIZE_MAX in the static_assert so
that it holds for every supported page size. In index_one_bio(), use
min_t(u32, ...) to compare sectorsize_bits with PAGE_SHIFT, because
PAGE_SHIFT is a variable of a different type and min() would not accept
the mix.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/btrfs/fs.h | 2 +-
fs/btrfs/raid56.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
index 2dd167c32d61..892626ab6d0f 100644
--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -56,7 +56,7 @@ struct btrfs_space_info;
/* The maximum folio size btrfs supports. */
#define BTRFS_MAX_FOLIO_SIZE (SZ_2M)
-static_assert(BTRFS_MAX_FOLIO_SIZE > PAGE_SIZE);
+static_assert(BTRFS_MAX_FOLIO_SIZE > PAGE_SIZE_MAX);
/*
* The maximum number of blocks a huge folio can support.
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 5ec31299f1c3..f614877316fb 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1289,7 +1289,7 @@ static void index_one_bio(struct btrfs_raid_bio *rbio, struct bio *bio)
{
struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
const u32 step = min(fs_info->sectorsize, PAGE_SIZE);
- const u32 step_bits = min(fs_info->sectorsize_bits, PAGE_SHIFT);
+ const u32 step_bits = min_t(u32, fs_info->sectorsize_bits, PAGE_SHIFT);
struct bvec_iter iter = bio->bi_iter;
phys_addr_t paddr;
u32 offset = (bio->bi_iter.bi_sector << SECTOR_SHIFT) -
next prev parent reply other threads:[~2026-12-02 3:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:15 ` Eric Curtin [this message]
2026-12-02 3:15 ` [RFC PATCH v2 19/22] btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks Eric Curtin
2026-12-02 8:53 ` Qu Wenruo
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=20261202031533.1665444-17-ericcurtin17@gmail.com \
--to=ericcurtin17@gmail.com \
--cc=dsterba@suse.com \
--cc=eric.curtin@docker.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.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