Linux NILFS development
 help / color / mirror / Atom feed
* [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions
       [not found] <20261202031533.1665444-1-ericcurtin17@gmail.com>
@ 2026-12-02  3:15 ` Eric Curtin
  0 siblings, 0 replies; only message in thread
From: Eric Curtin @ 2026-12-02  3:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Eric Curtin, Ryusuke Konishi, Viacheslav Dubeyko, linux-nilfs

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);
 }
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-02  3:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261202031533.1665444-1-ericcurtin17@gmail.com>
2026-12-02  3:15 ` [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox