[PATCH v2 42/83] block: rust: require `queue_rq` to return a `BlkResult`

From: Andreas Hindborg

Date: Tue Jun 09 2026 - 15:29:54 EST


Change the return type of `Operations::queue_rq` from `Result` to
`BlkResult`. This ensures that drivers return proper block layer status
codes that can be translated to the appropriate `blk_status_t` value.

Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
drivers/block/rnull/rnull.rs | 3 ++-
rust/kernel/block/mq.rs | 4 ++--
rust/kernel/block/mq/operations.rs | 13 ++++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
index bb8c4df08218..6ceba23a4d3e 100644
--- a/drivers/block/rnull/rnull.rs
+++ b/drivers/block/rnull/rnull.rs
@@ -20,6 +20,7 @@
BadBlocks, //
},
bio::Segment,
+ error::BlkResult,
mq::{
self,
gen_disk::{
@@ -595,7 +596,7 @@ fn queue_rq(
this: Pin<&Self>,
rq: Owned<mq::IdleRequest<Self>>,
_is_last: bool,
- ) -> Result {
+ ) -> BlkResult {
let mut rq = rq.start();
let mut sectors = rq.sectors();

diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
index e89eb394001f..503623267b19 100644
--- a/rust/kernel/block/mq.rs
+++ b/rust/kernel/block/mq.rs
@@ -64,7 +64,7 @@
//! ```rust
//! use kernel::{
//! alloc::NumaNode,
-//! block::mq::{self, *},
+//! block::{error::BlkResult, mq::{self, *}},
//! new_mutex,
//! prelude::*,
//! sync::{aref::ARef, Arc, Mutex},
@@ -90,7 +90,7 @@
//! _queue_data: (),
//! rq: Owned<IdleRequest<Self>>,
//! _is_last: bool
-//! ) -> Result {
+//! ) -> BlkResult {
//! rq.start().end_ok();
//! Ok(())
//! }
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index 01917ef213d1..b9a2bf6592b3 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -6,10 +6,13 @@

use crate::{
bindings,
- block::mq::{
- request::RequestDataWrapper,
- IdleRequest,
- Request, //
+ block::{
+ error::BlkResult,
+ mq::{
+ request::RequestDataWrapper,
+ IdleRequest,
+ Request, //
+ },
},
error::{
from_result,
@@ -82,7 +85,7 @@ fn queue_rq(
queue_data: ForeignBorrowed<'_, Self::QueueData>,
rq: Owned<IdleRequest<Self>>,
is_last: bool,
- ) -> Result;
+ ) -> BlkResult;

/// Called by the kernel to indicate that queued requests should be submitted.
fn commit_rqs(

--
2.51.2