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 --- drivers/block/rnull/rnull.rs | 3 ++- rust/kernel/block/mq.rs | 4 ++-- rust/kernel/block/mq/operations.rs | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs index 034ddc06eabf9..55cbdfed25414 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::{ @@ -577,7 +578,7 @@ fn queue_rq( this: Pin<&Self>, rq: Owned>, _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 a898dda2635e5..02738f52389ba 100644 --- a/rust/kernel/block/mq.rs +++ b/rust/kernel/block/mq.rs @@ -64,7 +64,7 @@ //! ```rust //! use kernel::{ //! bindings, -//! block::mq::{self, *}, +//! block::{error::BlkResult, mq::{self, *}}, //! new_mutex, //! prelude::*, //! sync::{aref::ARef, Arc, Mutex}, @@ -90,7 +90,7 @@ //! _queue_data: (), //! rq: Owned>, //! _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 fb75d65f67071..17468a39af60f 100644 --- a/rust/kernel/block/mq/operations.rs +++ b/rust/kernel/block/mq/operations.rs @@ -6,7 +6,10 @@ use crate::{ bindings, - block::mq::{request::RequestDataWrapper, IdleRequest, Request}, + block::{ + error::BlkResult, + mq::{request::RequestDataWrapper, IdleRequest, Request}, + }, error::{from_result, Result}, prelude::*, sync::{aref::ARef, atomic::ordering, Refcount}, @@ -62,7 +65,7 @@ fn queue_rq( queue_data: ForeignBorrowed<'_, Self::QueueData>, rq: Owned>, is_last: bool, - ) -> Result; + ) -> BlkResult; /// Called by the kernel to indicate that queued requests should be submitted. fn commit_rqs( -- 2.51.2