[PATCH v2 52/83] block: rust: add `TagSet::flags`

From: Andreas Hindborg

Date: Tue Jun 09 2026 - 15:16:42 EST


Add a way for block device drivers to query the flags that a `TagSet`
was configured with. This is needed so drivers can inspect properties
such as whether the tag set uses blocking queues.

Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/kernel/block/mq/tag_set.rs | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/rust/kernel/block/mq/tag_set.rs b/rust/kernel/block/mq/tag_set.rs
index 5359e60fb5a5..157c47f64334 100644
--- a/rust/kernel/block/mq/tag_set.rs
+++ b/rust/kernel/block/mq/tag_set.rs
@@ -107,6 +107,15 @@ pub fn new(
pub(crate) fn raw_tag_set(&self) -> *mut bindings::blk_mq_tag_set {
self.inner.get()
}
+
+ /// Return the [`Flags`] that this tag set was configured with.
+ pub fn flags(&self) -> Flags {
+ let this = self.raw_tag_set();
+ // SAFETY: By type invariant, `this` points to a valid and initialized
+ // `blk_mq_tag_set`.
+ let flags_raw = unsafe { (*this).flags };
+ Flags::try_from(flags_raw).expect("Expected valid flags from C struct")
+ }
}

#[pinned_drop]

--
2.51.2