rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
@ 2025-10-12 14:20 Shankari Anand
  2025-11-04 17:13 ` Shankari Anand
  2025-11-06  1:24 ` [PATCH " Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Shankari Anand @ 2025-10-12 14:20 UTC (permalink / raw)
  To: Andreas Hindborg, Jens Axboe, Miguel Ojeda, Alex Gaynor,
	linux-block, rust-for-linux, linux-kernel
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
---
Changelog:
v1 -> v2:
Rebased it on top of the latest linux-next upstream commit
Dropped 1/7 from the subject as it might lead to confusion of it being a series
Link of v1: https://lore.kernel.org/lkml/20250716090712.809750-1-shankari.ak0208@gmail.com/

The original patch of moving ARef and AlwaysRefCounted to sync::aref is here:
(commit 07dad44aa9a93)
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440


Gradually the re-export from types.rs will be eliminated in the
future cycle.
---
 
 drivers/block/rnull/rnull.rs       | 3 +--
 rust/kernel/block/mq.rs            | 5 ++---
 rust/kernel/block/mq/operations.rs | 4 ++--
 rust/kernel/block/mq/request.rs    | 8 ++++++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
index 1ec694d7f1a6..a9d5e575a2c4 100644
--- a/drivers/block/rnull/rnull.rs
+++ b/drivers/block/rnull/rnull.rs
@@ -17,8 +17,7 @@
     error::Result,
     pr_info,
     prelude::*,
-    sync::Arc,
-    types::ARef,
+    sync::{aref::ARef, Arc},
 };
 use pin_init::PinInit;
 
diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
index 637018ead0ab..1fd0d54dd549 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
@@ -61,8 +61,7 @@
 //!     block::mq::*,
 //!     new_mutex,
 //!     prelude::*,
-//!     sync::{Arc, Mutex},
-//!     types::{ARef, ForeignOwnable},
+//!     sync::{aref::ARef, Arc, Mutex},
 //! };
 //!
 //! struct MyBlkDevice;
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index f91a1719886c..8ad46129a52c 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -9,8 +9,8 @@
     block::mq::{request::RequestDataWrapper, Request},
     error::{from_result, Result},
     prelude::*,
-    sync::Refcount,
-    types::{ARef, ForeignOwnable},
+    sync::{aref::ARef, Refcount},
+    types::ForeignOwnable,
 };
 use core::marker::PhantomData;
 
diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index c5f1f6b1ccfb..ce3e30c81cb5 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -8,8 +8,12 @@
     bindings,
     block::mq::Operations,
     error::Result,
-    sync::{atomic::Relaxed, Refcount},
-    types::{ARef, AlwaysRefCounted, Opaque},
+    sync::{
+        aref::{ARef, AlwaysRefCounted},
+        atomic::Relaxed,
+        Refcount,
+    },
+    types::Opaque,
 };
 use core::{marker::PhantomData, ptr::NonNull};

base-commit: 2b763d4652393c90eaa771a5164502ec9dd965ae 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re:[PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
  2025-10-12 14:20 [PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref Shankari Anand
@ 2025-11-04 17:13 ` Shankari Anand
  2025-11-05 20:37   ` Andreas Hindborg
  2025-11-06  1:24 ` [PATCH " Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Shankari Anand @ 2025-11-04 17:13 UTC (permalink / raw)
  To: Andreas Hindborg, Jens Axboe, Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-block,
	rust-for-linux, linux-kernel, Shankari Anand

On Sun, Oct 12, 2025 at 07:50:12PM +0530, Shankari Anand wrote:
> 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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
> ---
> Changelog:
> v1 -> v2:
> Rebased it on top of the latest linux-next upstream commit
> Dropped 1/7 from the subject as it might lead to confusion of it being a series
> Link of v1: https://lore.kernel.org/lkml/20250716090712.809750-1-shankari.ak0208@gmail.com/
> 
> The original patch of moving ARef and AlwaysRefCounted to sync::aref is here:
> (commit 07dad44aa9a93)
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
> 
> 
> Gradually the re-export from types.rs will be eliminated in the
> future cycle.
> ---
>  
>  drivers/block/rnull/rnull.rs       | 3 +--
>  rust/kernel/block/mq.rs            | 5 ++---
>  rust/kernel/block/mq/operations.rs | 4 ++--
>  rust/kernel/block/mq/request.rs    | 8 ++++++--
>  4 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
> index 1ec694d7f1a6..a9d5e575a2c4 100644
> --- a/drivers/block/rnull/rnull.rs
> +++ b/drivers/block/rnull/rnull.rs
> @@ -17,8 +17,7 @@
>      error::Result,
>      pr_info,
>      prelude::*,
> -    sync::Arc,
> -    types::ARef,
> +    sync::{aref::ARef, Arc},
>  };
>  use pin_init::PinInit;
>  
> diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
> index 637018ead0ab..1fd0d54dd549 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
> @@ -61,8 +61,7 @@
>  //!     block::mq::*,
>  //!     new_mutex,
>  //!     prelude::*,
> -//!     sync::{Arc, Mutex},
> -//!     types::{ARef, ForeignOwnable},
> +//!     sync::{aref::ARef, Arc, Mutex},
>  //! };
>  //!
>  //! struct MyBlkDevice;
> diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
> index f91a1719886c..8ad46129a52c 100644
> --- a/rust/kernel/block/mq/operations.rs
> +++ b/rust/kernel/block/mq/operations.rs
> @@ -9,8 +9,8 @@
>      block::mq::{request::RequestDataWrapper, Request},
>      error::{from_result, Result},
>      prelude::*,
> -    sync::Refcount,
> -    types::{ARef, ForeignOwnable},
> +    sync::{aref::ARef, Refcount},
> +    types::ForeignOwnable,
>  };
>  use core::marker::PhantomData;
>  
> diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
> index c5f1f6b1ccfb..ce3e30c81cb5 100644
> --- a/rust/kernel/block/mq/request.rs
> +++ b/rust/kernel/block/mq/request.rs
> @@ -8,8 +8,12 @@
>      bindings,
>      block::mq::Operations,
>      error::Result,
> -    sync::{atomic::Relaxed, Refcount},
> -    types::{ARef, AlwaysRefCounted, Opaque},
> +    sync::{
> +        aref::{ARef, AlwaysRefCounted},
> +        atomic::Relaxed,
> +        Refcount,
> +    },
> +    types::Opaque,
>  };
>  use core::{marker::PhantomData, ptr::NonNull};
> 
> base-commit: 2b763d4652393c90eaa771a5164502ec9dd965ae 
> -- 
> 2.34.1
> 
Hello, can this patch be reviewed?

Thanks,
Shankari

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:[PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
  2025-11-04 17:13 ` Shankari Anand
@ 2025-11-05 20:37   ` Andreas Hindborg
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Hindborg @ 2025-11-05 20:37 UTC (permalink / raw)
  To: Shankari Anand, Jens Axboe, Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-block,
	rust-for-linux, linux-kernel, Shankari Anand

"Shankari Anand" <shankari.ak0208@gmail.com> writes:

> On Sun, Oct 12, 2025 at 07:50:12PM +0530, Shankari Anand wrote:
>> 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@kernel.org>
>> Link: https://github.com/Rust-for-Linux/linux/issues/1173
>> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
>> ---
>> Changelog:
>> v1 -> v2:
>> Rebased it on top of the latest linux-next upstream commit
>> Dropped 1/7 from the subject as it might lead to confusion of it being a series
>> Link of v1: https://lore.kernel.org/lkml/20250716090712.809750-1-shankari.ak0208@gmail.com/
>>
>> The original patch of moving ARef and AlwaysRefCounted to sync::aref is here:
>> (commit 07dad44aa9a93)
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
>>
>>
>> Gradually the re-export from types.rs will be eliminated in the
>> future cycle.
>> ---
>>
>>  drivers/block/rnull/rnull.rs       | 3 +--
>>  rust/kernel/block/mq.rs            | 5 ++---
>>  rust/kernel/block/mq/operations.rs | 4 ++--
>>  rust/kernel/block/mq/request.rs    | 8 ++++++--
>>  4 files changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
>> index 1ec694d7f1a6..a9d5e575a2c4 100644
>> --- a/drivers/block/rnull/rnull.rs
>> +++ b/drivers/block/rnull/rnull.rs
>> @@ -17,8 +17,7 @@
>>      error::Result,
>>      pr_info,
>>      prelude::*,
>> -    sync::Arc,
>> -    types::ARef,
>> +    sync::{aref::ARef, Arc},
>>  };
>>  use pin_init::PinInit;
>>
>> diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
>> index 637018ead0ab..1fd0d54dd549 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
>> @@ -61,8 +61,7 @@
>>  //!     block::mq::*,
>>  //!     new_mutex,
>>  //!     prelude::*,
>> -//!     sync::{Arc, Mutex},
>> -//!     types::{ARef, ForeignOwnable},
>> +//!     sync::{aref::ARef, Arc, Mutex},
>>  //! };
>>  //!
>>  //! struct MyBlkDevice;
>> diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
>> index f91a1719886c..8ad46129a52c 100644
>> --- a/rust/kernel/block/mq/operations.rs
>> +++ b/rust/kernel/block/mq/operations.rs
>> @@ -9,8 +9,8 @@
>>      block::mq::{request::RequestDataWrapper, Request},
>>      error::{from_result, Result},
>>      prelude::*,
>> -    sync::Refcount,
>> -    types::{ARef, ForeignOwnable},
>> +    sync::{aref::ARef, Refcount},
>> +    types::ForeignOwnable,
>>  };
>>  use core::marker::PhantomData;
>>
>> diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
>> index c5f1f6b1ccfb..ce3e30c81cb5 100644
>> --- a/rust/kernel/block/mq/request.rs
>> +++ b/rust/kernel/block/mq/request.rs
>> @@ -8,8 +8,12 @@
>>      bindings,
>>      block::mq::Operations,
>>      error::Result,
>> -    sync::{atomic::Relaxed, Refcount},
>> -    types::{ARef, AlwaysRefCounted, Opaque},
>> +    sync::{
>> +        aref::{ARef, AlwaysRefCounted},
>> +        atomic::Relaxed,
>> +        Refcount,
>> +    },
>> +    types::Opaque,
>>  };
>>  use core::{marker::PhantomData, ptr::NonNull};
>>
>> base-commit: 2b763d4652393c90eaa771a5164502ec9dd965ae
>> --
>> 2.34.1
>>
> Hello, can this patch be reviewed?

I think I already ACK'ed this patch [1]. I can't apply patches for
block. Jens or Miguel should apply this.

Best regards,
Andreas Hindborg


[1] https://lore.kernel.org/r/87cy965edf.fsf@kernel.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
  2025-10-12 14:20 [PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref Shankari Anand
  2025-11-04 17:13 ` Shankari Anand
@ 2025-11-06  1:24 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-11-06  1:24 UTC (permalink / raw)
  To: Andreas Hindborg, Miguel Ojeda, Alex Gaynor, linux-block,
	rust-for-linux, linux-kernel, Shankari Anand
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich


On Sun, 12 Oct 2025 19:50:12 +0530, Shankari Anand wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] rust: block: update ARef and AlwaysRefCounted imports from sync::aref
      commit: ba13710ddd1f47884701213a3b6a5e470f6bc81e

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-06  1:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-12 14:20 [PATCH v2] rust: block: update ARef and AlwaysRefCounted imports from sync::aref Shankari Anand
2025-11-04 17:13 ` Shankari Anand
2025-11-05 20:37   ` Andreas Hindborg
2025-11-06  1:24 ` [PATCH " Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).