[PATCH 71/79] block: rust: add `Request::requeue`
From: Andreas Hindborg
Date: Sun Feb 15 2026 - 18:47:56 EST
Add a method on `Request` to requeue the request with the block layer.
Drivers can use this method to send a request back to the block layer
without processing the request.
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/kernel/block/mq/request.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index e2fafe7737379..af10dcbd3ffd1 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -75,6 +75,18 @@ pub(crate) unsafe fn from_raw(ptr: *mut bindings::request) -> Owned<Self> {
// SAFETY: By function safety requirements, `ptr` is valid for use as an `IdleRequest`.
unsafe { Owned::from_raw(NonNull::<Self>::new_unchecked(ptr.cast())) }
}
+
+ /// Requeue this request at the block layer.
+ ///
+ /// If `kick_requeue_list` is true, this method will schedule processing of
+ /// the requeue list on a workqueue.
+ pub fn requeue(self: Owned<Self>, kick_requeue_list: bool) {
+ let ptr = self.0 .0.get();
+ core::mem::forget(self);
+
+ // SAFETY: By type invariant, the wrapped request is valid.
+ unsafe { bindings::blk_mq_requeue_request(ptr, kick_requeue_list) };
+ }
}
// SAFETY: The `release` implementation leaks the `IdleRequest`, which is a valid state for a
--
2.51.2