public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: "Benno Lossin" <lossin@kernel.org>
To: "Adrián García Casado" <adriangarciacasado42@gmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Jens Axboe" <axboe@kernel.dk>
Cc: "Boqun Feng" <boqun@kernel.org>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	<rust-for-linux@vger.kernel.org>, <linux-block@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] rust: block: rnull: update to Pin<KBox<QueueData>> for PinInit
Date: Wed, 18 Mar 2026 08:44:32 +0100	[thread overview]
Message-ID: <DH5QNZZ3SVKE.QX0JBZ2AVQEO@kernel.org> (raw)
In-Reply-To: <20260317193257.13848-1-adriangarciacasado42@gmail.com>

On Tue Mar 17, 2026 at 8:32 PM CET, Adrián García Casado wrote:
> Utilize the pin_init! macro for QueueData initialization to correctly support in-place initialization patterns. This aligns the driver with standard Rust-for-Linux pinning practices for driver-specific queue data.
>
> Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>

You haven't replied to Miguel's questions and disregarded his advice to
wait for maintainers to get back to you before sending a new version.

The patch itself is completely unnecessary, there is no need for pinning
for `QueueData` proven by the fact that the code works as is. Please
reply with an email explaining your thought process and don't send
another version.

Cheers,
Benno

> ---
>  drivers/block/rnull/rnull.rs | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
> index 0ca8715fe..11ea0696d 100644
> --- a/drivers/block/rnull/rnull.rs
> +++ b/drivers/block/rnull/rnull.rs
> @@ -54,7 +54,7 @@ fn new(
>      ) -> Result<GenDisk<Self>> {
>          let tagset = Arc::pin_init(TagSet::new(1, 256, 1), GFP_KERNEL)?;
>  
> -        let queue_data = Box::new(QueueData { irq_mode }, GFP_KERNEL)?;
> +        let queue_data = Box::pin_init(pin_init!(QueueData { irq_mode }), GFP_KERNEL)?;
>  
>          gen_disk::GenDiskBuilder::new()
>              .capacity_sectors(capacity_mib << (20 - block::SECTOR_SHIFT))
> @@ -65,16 +65,21 @@ fn new(
>      }
>  }
>  
> +#[pin_data]
>  struct QueueData {
>      irq_mode: IRQMode,
>  }
>  
>  #[vtable]
>  impl Operations for NullBlkDevice {
> -    type QueueData = KBox<QueueData>;
> +    type QueueData = Pin<KBox<QueueData>>;
>  
>      #[inline(always)]
> -    fn queue_rq(queue_data: &QueueData, rq: ARef<mq::Request<Self>>, _is_last: bool) -> Result {
> +    fn queue_rq(
> +        queue_data: Pin<&QueueData>,
> +        rq: ARef<mq::Request<Self>>,
> +        _is_last: bool,
> +    ) -> Result {
>          match queue_data.irq_mode {
>              IRQMode::None => mq::Request::end_ok(rq)
>                  .map_err(|_e| kernel::error::code::EIO)
> @@ -87,7 +92,7 @@ fn queue_rq(queue_data: &QueueData, rq: ARef<mq::Request<Self>>, _is_last: bool)
>          Ok(())
>      }
>  
> -    fn commit_rqs(_queue_data: &QueueData) {}
> +    fn commit_rqs(_queue_data: Pin<&QueueData>) {}
>  
>      fn complete(rq: ARef<mq::Request<Self>>) {
>          mq::Request::end_ok(rq)


  reply	other threads:[~2026-03-18  7:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2hK6oarCGyUX9gXNJ6wZZoePYLShXTYjw8wOlhbW1szik-km-pMO8wtX6dgm5i34HLG2zxzqZgK-cb2MiDtdpw==@protonmail.internalid>
2026-03-17 19:32 ` [PATCH v4] rust: block: rnull: update to Pin<KBox<QueueData>> for PinInit Adrián García Casado
2026-03-18  7:44   ` Benno Lossin [this message]
2026-03-18 13:03   ` Andreas Hindborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DH5QNZZ3SVKE.QX0JBZ2AVQEO@kernel.org \
    --to=lossin@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=adriangarciacasado42@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=boqun@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox