From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
Ryusuke Konishi <konishi.ryusuke@gmail.com>,
Viacheslav Dubeyko <slava@dubeyko.com>,
linux-nilfs@vger.kernel.org
Subject: [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions
Date: Wed, 2 Dec 2026 03:15:09 +0000 [thread overview]
Message-ID: <20261202031533.1665444-7-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 is not a compile-time
constant, so it cannot be used in #if.
Replace the #if (PAGE_SIZE >= 65536) blocks in nilfs_rec_len_from_disk()
and nilfs_rec_len_to_disk() with ordinary C conditions. The compiler
still removes the dead code when PAGE_SIZE is constant.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/nilfs2/dir.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 7686ca9228fc..afc05387f946 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -38,21 +38,19 @@ static inline unsigned int nilfs_rec_len_from_disk(__le16 dlen)
{
unsigned int len = le16_to_cpu(dlen);
-#if (PAGE_SIZE >= 65536)
- if (len == NILFS_MAX_REC_LEN)
+ if (PAGE_SIZE >= 65536 && len == NILFS_MAX_REC_LEN)
return 1 << 16;
-#endif
return len;
}
static inline __le16 nilfs_rec_len_to_disk(unsigned int len)
{
-#if (PAGE_SIZE >= 65536)
- if (len == (1 << 16))
- return cpu_to_le16(NILFS_MAX_REC_LEN);
+ if (PAGE_SIZE >= 65536) {
+ if (len == (1 << 16))
+ return cpu_to_le16(NILFS_MAX_REC_LEN);
- BUG_ON(len > (1 << 16));
-#endif
+ BUG_ON(len > (1 << 16));
+ }
return cpu_to_le16(len);
}
parent reply other threads:[~2026-12-02 3:15 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261202031533.1665444-1-ericcurtin17@gmail.com>]
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-7-ericcurtin17@gmail.com \
--to=ericcurtin17@gmail.com \
--cc=eric.curtin@docker.com \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=slava@dubeyko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox