[PATCH v2 0/2] rnull: support 64K pages
From: Vitaly Wool
Date: Fri Dec 04 2026 - 05:05:29 EST
rnull does not build with 64K pages: NullBlockPage keeps the status of
a page's sectors in a single u64, and a static assertion limits pages
to 64 sectors, while a 64K page has 128. This also affects other
architectures with pages larger than 32K.
Patch 1 adds BitArray, a kernel::bitmap type that stores its bits
inline, never allocates and dereferences to Bitmap like BitmapVec. Like
DECLARE_BITMAP() in C, it is declared by its number of bits, with
bit_array!(nbits). Patch 2 uses it for the status, one bit per sector
of a page, so that a backing page still needs no extra allocation. This
also resolves the TODO to use the Rust bitmap.
Changes in v2:
- BitmapArray is renamed to BitArray, and is declared in bits rather
than words, so users no longer depend on the size of usize.
bit_array!(nbits) gives the type, and bits_to_longs() is the
equivalent of BITS_TO_LONGS(). The number of words is still a second
const parameter, as computing it from the number of bits needs
generic_const_exprs; new() checks at compile time that the two match.
The length is now the declared number of bits, so new() takes no
argument and cannot fail.
- The v1 doc example assumed 64-bit words and failed on 32-bit; the
examples now behave the same on 32-bit and 64-bit.
Each patch builds without warnings on x86_64. On arm64 with
CONFIG_ARM64_64K_PAGES the series builds without warnings; with patch 1
alone, rnull still fails its existing 64-sector static assertion, which
patch 2 removes.
The series is based on rnull-v7.4-rc2 from Andreas' tree [1].
Vitaly Wool (2):
rust: bitmap: add BitArray
rnull: size the sector status bitmap for any page size
drivers/block/rnull/disk_storage/page.rs | 44 ++++----
rust/kernel/bitmap.rs | 129 +++++++++++++++++++++++
2 files changed, 153 insertions(+), 20 deletions(-)
base-commit: 9c0fceca4feed5f1056f55abe9c7c70731402776
--
2.39.5
[1] https://github.com/metaspace/linux