[PATCH 70/79] block: rust: add `Request::queue_index`

From: Andreas Hindborg

Date: Sun Feb 15 2026 - 19:02:57 EST


Add a method to query a request about the index for the hardware queue
associated with the request.

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

diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index 9a05bce39c64b..e2fafe7737379 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -166,6 +166,13 @@ pub fn hw_data(&self) -> <T::HwData as ForeignOwnable>::Borrowed<'_> {
unsafe { T::HwData::borrow((*hctx).driver_data) }
}

+ /// Get the queue index for the hardware queue associated with this request.
+ pub fn queue_index(&self) -> u32 {
+ // SAFETY: The requests is guaranteed to be associated with a hardware
+ // context while we have access to it.
+ unsafe { (*self.hctx_raw()).queue_num }
+ }
+
pub fn is_poll(&self) -> bool {
let hctx = self.hctx_raw();


--
2.51.2