[RFC PATCH 0/2] rust block-mq TagSet flags plumbing and rnull blocking wiring

Wenzhao Liao posted 2 patches 2 months ago
drivers/block/rnull/configfs.rs | 32 +++++++++++-
drivers/block/rnull/rnull.rs    | 11 ++++-
rust/kernel/block/mq.rs         |  2 +-
rust/kernel/block/mq/tag_set.rs | 86 ++++++++++++++++++++++++++++++++-
4 files changed, 126 insertions(+), 5 deletions(-)
[RFC PATCH 0/2] rust block-mq TagSet flags plumbing and rnull blocking wiring
Posted by Wenzhao Liao 2 months ago
This RFC series fills a practical gap in the Rust block-mq abstraction by
exposing blk_mq_tag_set.flags safely, then wires one in-tree consumer
(`rnull`) via configfs as a reference.

Patch 1 introduces `TagSetFlags` and `TagSet::new_with_flags(...)` while
keeping `TagSet::new(...)` for compatibility.

Patch 2 adds a `blocking` configfs attribute to `rnull` and maps it to
`TagSetFlags::BLOCKING` when powering on a device.

Validation summary:
- Out-of-tree build on rust-next (LLVM=-15): defconfig, rustavailable.
- Enabled CONFIG_RUST=y, CONFIG_CONFIGFS_FS=y, CONFIG_BLK_DEV_RUST_NULL=m.
- Built vmlinux and drivers/block/rnull/rnull_mod.ko successfully.
- QEMU runtime test (initramfs automation) verifies:
  - `/sys/kernel/config/rnull/features` contains `blocking`;
  - writing `blocking` while powered on fails with busy semantics;
  - writing `blocking` after power off succeeds again.

Comments on API naming and any preferred follow-up scope are welcome.

Wenzhao Liao (2):
  rust: block: mq: safely expose TagSet flags
  block: rnull: support BLK_MQ_F_BLOCKING via configfs

 drivers/block/rnull/configfs.rs | 32 +++++++++++-
 drivers/block/rnull/rnull.rs    | 11 ++++-
 rust/kernel/block/mq.rs         |  2 +-
 rust/kernel/block/mq/tag_set.rs | 86 ++++++++++++++++++++++++++++++++-
 4 files changed, 126 insertions(+), 5 deletions(-)


base-commit: 3418d862679ac6da0b6bd681b18b3189c4fad20d
-- 
2.34.1
Re: [RFC PATCH 0/2] rust block-mq TagSet flags plumbing and rnull blocking wiring
Posted by Andreas Hindborg 2 months ago
Hi Wenzhao,

"Wenzhao Liao" <wenzhaoliao@ruc.edu.cn> writes:

> This RFC series fills a practical gap in the Rust block-mq abstraction by
> exposing blk_mq_tag_set.flags safely, then wires one in-tree consumer
> (`rnull`) via configfs as a reference.

Patches for this functionality is already submitted to list [1]. Please
take a look if those patches solve your requirement. If you require this
functionality in the kernel, please help by reviewing the patches in
that series.

Best regards,
Andreas Hindborg


[1] https://lore.kernel.org/rust-for-linux/20260216-rnull-v6-19-rc5-send-v1-12-de9a7af4b469@kernel.org/