mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: block: Fix GenDiskBuilder block size documentation
@ 2026-08-31  3:47 ` Sophon Z via B4 Relay
  2026-08-31 12:55   ` Andreas Hindborg
  0 siblings, 1 reply; 4+ messages in thread
From: Sophon Z via B4 Relay @ 2026-08-31  3:47 UTC (permalink / raw)
  To: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
	Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan
  Cc: linux-block, rust-for-linux, linux-kernel, Sophon Z

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>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rust: block: Fix GenDiskBuilder block size documentation
  2026-08-31  3:47 ` [PATCH] rust: block: Fix GenDiskBuilder block size documentation Sophon Z via B4 Relay
@ 2026-08-31 12:55   ` Andreas Hindborg
       [not found]     ` <SN7PR07MB9708ED760C7DDF833BEE80E1CFA82@SN7PR07MB9708.namprd07.prod.outlook.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Hindborg @ 2026-08-31 12:55 UTC (permalink / raw)
  To: Sophon Z via B4 Relay, Boqun Feng, Miguel Ojeda, Gary Guo,
	Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan
  Cc: linux-block, rust-for-linux, linux-kernel, Sophon Z

"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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rust: block: Fix GenDiskBuilder block size documentation
       [not found]     ` <SN7PR07MB9708ED760C7DDF833BEE80E1CFA82@SN7PR07MB9708.namprd07.prod.outlook.com>
@ 2026-09-01  9:13       ` Miguel Ojeda
  2026-09-01  9:42       ` 回复: " ai qubits
  1 sibling, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2026-09-01  9:13 UTC (permalink / raw)
  To: ai qubits
  Cc: Andreas Hindborg, Sophon Z via B4 Relay, Boqun Feng,
	Miguel Ojeda, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Daniel Almeida,
	Tamir Duberstein, Alexandre Courbot, Onur Özkan,
	linux-block, rust-for-linux, linux-kernel

On Tue, Sep 1, 2026 at 4:00 AM ai qubits <aiqubits@hotmail.com> wrote:
>
> Thanks for the review and the Ack.
>
> Understood. I will leave this documentation fix as-is for Jens to pick up
> and prepare a separate follow-up patch after it lands.
>
> The follow-up will add a helper in rust/helpers/blk.c for
> blk_validate_block_size(), use it from
> GenDiskBuilder::validate_block_size(), and update the documentation to
> avoid specifying a configuration-dependent upper bound.

Note: I don't think your messages will be accepted by the mailing
list, since they use HTML. Please switch to plain text -- thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [PATCH] rust: block: Fix GenDiskBuilder block size documentation
       [not found]     ` <SN7PR07MB9708ED760C7DDF833BEE80E1CFA82@SN7PR07MB9708.namprd07.prod.outlook.com>
  2026-09-01  9:13       ` Miguel Ojeda
@ 2026-09-01  9:42       ` ai qubits
  1 sibling, 0 replies; 4+ messages in thread
From: ai qubits @ 2026-09-01  9:42 UTC (permalink / raw)
  To: Andreas Hindborg, Sophon Z via B4 Relay, Boqun Feng,
	Miguel Ojeda, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Daniel Almeida,
	Tamir Duberstein, Alexandre Courbot, Onur Özkan
  Cc: linux-block, rust-for-linux, linux-kernel

Thanks for the review and the Ack.

Understood. I will leave this documentation fix as-is for Jens to pick up
and prepare a separate follow-up patch after it lands.

The follow-up will add a helper in rust/helpers/blk.c for
blk_validate_block_size(), use it from
GenDiskBuilder::validate_block_size(), and update the documentation to
avoid specifying a configuration-dependent upper bound.

Best regards,
Sophon

// Reason for Resending

Note: I don't think your messages will be accepted by the mailing
list, since they use HTML. Please switch to plain text -- thanks!

Cheers,
Miguel

Hi Miguel,
Thanks for the reminder. I will resend it in plain text.

Best regards,
Sophon

________________________________________
发件人: ai qubits <aiqubits@hotmail.com>
发送时间: 2026年9月1日 10:00
收件人: Andreas Hindborg; Sophon Z via B4 Relay; Boqun Feng; Miguel Ojeda; Gary Guo; Björn Roy Baron; Benno Lossin; Alice Ryhl; Trevor Gross; Danilo Krummrich; Daniel Almeida; Tamir Duberstein; Alexandre Courbot; Onur Özkan
抄送: linux-block@vger.kernel.org; rust-for-linux@vger.kernel.org; linux-kernel@vger.kernel.org
主题: 回复: [PATCH] rust: block: Fix GenDiskBuilder block size documentation

Thanks for the review and the Ack.

Understood. I will leave this documentation fix as-is for Jens to pick up
and prepare a separate follow-up patch after it lands.

The follow-up will add a helper in rust/helpers/blk.c for
blk_validate_block_size(), use it from
GenDiskBuilder::validate_block_size(), and update the documentation to
avoid specifying a configuration-dependent upper bound.

Best regards,
Sophon
________________________________
发件人: Andreas Hindborg <a.hindborg@kernel.org>
发送时间: 2026年8月31日 20:55
收件人: Sophon Z via B4 Relay <devnull+aiqubits.hotmail.com@kernel.org>; Boqun Feng <boqun@kernel.org>; Miguel Ojeda <ojeda@kernel.org>; Gary Guo <gary@garyguo.net>; Björn Roy Baron <bjorn3_gh@protonmail.com>; Benno Lossin <lossin@kernel.org>; Alice Ryhl <aliceryhl@google.com>; Trevor Gross <tmgross@umich.edu>; Danilo Krummrich <dakr@kernel.org>; Daniel Almeida <daniel.almeida@collabora.com>; Tamir Duberstein <tamird@kernel.org>; Alexandre Courbot <acourbot@nvidia.com>; Onur Özkan <work@onurozkan.dev>
抄送: linux-block@vger.kernel.org <linux-block@vger.kernel.org>; rust-for-linux@vger.kernel.org <rust-for-linux@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; Sophon Z <aiqubits@hotmail.com>
主题: Re: [PATCH] rust: block: Fix GenDiskBuilder block size documentation

"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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-01  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <eqzS1cYG2bYJ10oFrfX_D7UVNqb_NuK3wsMUUEXpdBj7yCtzD24WOzI8zIKg2FlD04VFp_R9xt65fGmEqpt6QA==@protonmail.internalid>
2026-08-31  3:47 ` [PATCH] rust: block: Fix GenDiskBuilder block size documentation Sophon Z via B4 Relay
2026-08-31 12:55   ` Andreas Hindborg
     [not found]     ` <SN7PR07MB9708ED760C7DDF833BEE80E1CFA82@SN7PR07MB9708.namprd07.prod.outlook.com>
2026-09-01  9:13       ` Miguel Ojeda
2026-09-01  9:42       ` 回复: " ai qubits

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

all inboxes | Powered by JetHome®