rust/kernel/block/mq/gen_disk.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
From: Sophon Z <aiqubits@hotmail.com>
GenDiskBuilder::validate_block_size() accepts powers of two from 512
through PAGE_SIZE, but the documentation for logical_block_size() and
physical_block_size() states that the maximum is 4096.
Use PAGE_SIZE for both documented upper bounds so that the documentation
matches validation on architectures with larger page sizes.
Signed-off-by: Sophon Z <aiqubits@hotmail.com>
---
rust/kernel/block/mq/gen_disk.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index fc97dd873974..119ee522d854 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -63,7 +63,7 @@ pub fn validate_block_size(size: u32) -> Result {
/// Set the logical block size of the device to be built.
///
/// This method will check that block size is a power of two and between 512
- /// and 4096. If not, an error is returned and the block size is not set.
+ /// and `PAGE_SIZE`. If not, an error is returned and the block size is not set.
///
/// This is the smallest unit the storage device can address. It is
/// typically 4096 bytes.
@@ -76,7 +76,7 @@ pub fn logical_block_size(mut self, block_size: u32) -> Result<Self> {
/// Set the physical block size of the device to be built.
///
/// This method will check that block size is a power of two and between 512
- /// and 4096. If not, an error is returned and the block size is not set.
+ /// and `PAGE_SIZE`. If not, an error is returned and the block size is not set.
///
/// This is the smallest unit a physical storage device can write
/// atomically. It is usually the same as the logical block size but may be
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260831-fix-gendisk-block-size-docs-c3e22ac70565
Best regards,
--
Sophon Z <aiqubits@hotmail.com>
"Sophon Z via B4 Relay" <devnull+aiqubits.hotmail.com@kernel.org> writes: > From: Sophon Z <aiqubits@hotmail.com> > > GenDiskBuilder::validate_block_size() accepts powers of two from 512 > through PAGE_SIZE, but the documentation for logical_block_size() and > physical_block_size() states that the maximum is 4096. > > Use PAGE_SIZE for both documented upper bounds so that the documentation > matches validation on architectures with larger page sizes. > > Signed-off-by: Sophon Z <aiqubits@hotmail.com> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> @Jens, please pick this one. @Sophon I'd like to call the C static inline `blk_validate_block_size` here instead reproducing the check. Feel free to add a patch. You need to add a helper in rust/helpers/blk.c to be able to call the function. You would also need to update the documentation again, as the C function has special handling when transparent huge pages are enabled. I would suggest to just saying "check that the block size is valid". Best regards, Andreas Hindborg
© 2016 - 2026 Red Hat, Inc.