[RFC PATCH v2 15/22] ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check

From: Eric Curtin

Date: Tue Dec 01 2026 - 22:17:18 EST


From: Eric Curtin <eric.curtin@xxxxxxxxxx>

With arm64 boot-time page size selection PAGE_SHIFT is not a compile-
time constant, so it cannot be used in BUILD_BUG_ON().

ceph_fscrypt_blocks() asserts that a crypto block does not span more
than one page. Compare CEPH_FSCRYPT_BLOCK_SHIFT against PAGE_SHIFT_MIN
so that the assertion holds for every supported page size.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/ceph/crypto.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
index d199dc8410fe..612f477e5164 100644
--- a/fs/ceph/crypto.h
+++ b/fs/ceph/crypto.h
@@ -122,7 +122,7 @@ int ceph_fscrypt_prepare_readdir(struct inode *dir);
static inline unsigned int ceph_fscrypt_blocks(u64 off, u64 len)
{
/* crypto blocks cannot span more than one page */
- BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT);
+ BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT_MIN);

return ((off+len+CEPH_FSCRYPT_BLOCK_SIZE-1) >> CEPH_FSCRYPT_BLOCK_SHIFT) -
(off >> CEPH_FSCRYPT_BLOCK_SHIFT);