[PATCH 25/79] block: rust: mq: add Request::end() method for custom status codes

From: Andreas Hindborg

Date: Sun Feb 15 2026 - 18:44:44 EST


Add end() method to Request that accepts a custom status code parameter,
refactoring end_ok() to use it with BLK_STS_OK.

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

diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index 8fe7e126c522a..38289b9f966fa 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -297,13 +297,18 @@ pub(crate) unsafe fn start_unchecked(&mut self) {

/// Notify the block layer that the request has been completed without errors.
pub fn end_ok(self) {
+ self.end(bindings::BLK_STS_OK)
+ }
+
+ /// Notify the block layer that the request has been completed.
+ pub fn end(self, status: u8) {
let request_ptr = self.0.get().cast();
core::mem::forget(self);
// SAFETY: By type invariant, `this.0` was a valid `struct request`. The
// existence of `self` guarantees that there are no `ARef`s pointing to
// this request. Therefore it is safe to hand it back to the block
// layer.
- unsafe { bindings::blk_mq_end_request(request_ptr, bindings::BLK_STS_OK) };
+ unsafe { bindings::blk_mq_end_request(request_ptr, status) };
}
}


--
2.51.2