[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ldoyn1a9.fsf@kernel.org>
Date: Tue, 08 Jul 2025 17:35:26 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Benno Lossin" <lossin@...nel.org>
Cc: "Oliver Mangold" <oliver.mangold@...me>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Alice Ryhl" <aliceryhl@...gle.com>, "Trevor
Gross" <tmgross@...ch.edu>, "Asahi Lina" <lina+kernel@...hilina.net>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v11 4/4] rust: Add `OwnableRefCounted`
"Benno Lossin" <lossin@...nel.org> writes:
> On Tue Jul 8, 2025 at 3:15 PM CEST, Andreas Hindborg wrote:
>> "Benno Lossin" <lossin@...nel.org> writes:
>>> On Mon Jul 7, 2025 at 3:21 PM CEST, Andreas Hindborg wrote:
>>>> When a completion comes back from hardware, it carries the ID. We use
>>>> the C block layer `tag_to_rq` machinery to turn this ID back into an
>>>> `Owned<Request<_>>`. In that process, we check that `refcount == 1` and
>>>> if so, we set refcount to 0 and invent an `Owned<Request<_>>`.
>>>
>>> (because if not, this would be wrong)
>>
>> I hope it is not wrong 😆 You can see the latest and greatest here [1].
>
> Thanks for the pointer, the "implementation details" in the docs on
> `Request` were very helpful! This is another argument for not having the
> blanket impl for `Ownable` when `T: Refcount` I mentioned in the other
> thread.
>
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git/tree/rust/kernel/block/mq/request.rs?h=rnull-v6.15#n398
>
> The comment in line 424 looks wrong?
Yes, nice catch. The assert is correct though.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists