[PATCH 1/7] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
From: Shankari Anand
Date: Wed Jul 16 2025 - 05:09:55 EST
Update call sites in the block subsystem to import `ARef` and
`AlwaysRefCounted` from `sync::aref` instead of `types`.
This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.
Suggested-by: Benno Lossin <lossin@xxxxxxxxxx>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@xxxxxxxxx>
---
It part of a subsystem-wise split series, as suggested in:
https://lore.kernel.org/rust-for-linux/CANiq72=NSRMV_6UxXVgkebmWmbgN4i=sfRszr-G+x3W5A4DYOg@xxxxxxxxxxxxxx/T/#u
This split series is intended to ease review and subsystem-level maintenance.
The original moving patch is here:
https://lore.kernel.org/rust-for-linux/20250625111133.698481-1-shankari.ak0208@xxxxxxxxx/
Gradually the re-export from types.rs will be eliminated in the
future cycle.
---
drivers/block/rnull.rs | 3 +--
rust/kernel/block/mq.rs | 8 ++++----
rust/kernel/block/mq/operations.rs | 2 +-
rust/kernel/block/mq/request.rs | 3 ++-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/block/rnull.rs b/drivers/block/rnull.rs
index d07e76ae2c13..80a0f7aa949e 100644
--- a/drivers/block/rnull.rs
+++ b/drivers/block/rnull.rs
@@ -20,8 +20,7 @@
error::Result,
new_mutex, pr_info,
prelude::*,
- sync::{Arc, Mutex},
- types::ARef,
+ sync::{aref::ARef, Arc, Mutex},
};
module! {
diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
index 831445d37181..3e7e0de92604 100644
--- a/rust/kernel/block/mq.rs
+++ b/rust/kernel/block/mq.rs
@@ -20,7 +20,7 @@
//! The kernel will interface with the block device driver by calling the method
//! implementations of the `Operations` trait.
//!
-//! IO requests are passed to the driver as [`kernel::types::ARef<Request>`]
+//! IO requests are passed to the driver as [`kernel::sync::aref::ARef<Request>`]
//! instances. The `Request` type is a wrapper around the C `struct request`.
//! The driver must mark end of processing by calling one of the
//! `Request::end`, methods. Failure to do so can lead to deadlock or timeout
@@ -57,12 +57,12 @@
//!
//! ```rust
//! use kernel::{
//! alloc::flags,
//! block::mq::*,
//! new_mutex,
//! prelude::*,
-//! sync::{Arc, Mutex},
-//! types::{ARef, ForeignOwnable},
+//! sync::{aref::ARef, Arc, Mutex},
+//! types::ForeignOwnable,
//! };
//!
//! struct MyBlkDevice;
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index c2b98f507bcb..18d858763e08 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -10,7 +10,7 @@
block::mq::Request,
error::{from_result, Result},
prelude::*,
- types::ARef,
+ sync::aref::ARef,
};
use core::{marker::PhantomData, sync::atomic::AtomicU64, sync::atomic::Ordering};
diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index fefd394f064a..9cca7852b309 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -8,7 +8,8 @@
bindings,
block::mq::Operations,
error::Result,
- types::{ARef, AlwaysRefCounted, Opaque},
+ sync::aref::{ARef, AlwaysRefCounted},
+ types::Opaque,
};
use core::{
marker::PhantomData,
--
2.34.1