From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E47B01F4C85; Fri, 28 Feb 2025 18:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740767353; cv=none; b=BHnr5aQ9h7YncIW4YfL0ocjXUTK0MXt9x/+Ch6CH8f7Ee2ueronA2fa/ZAP/CefdiJDoXvaMXHDamFPFtsbNXRmbQTfiAVZDjIK46IZXIunZyWQLb2Tc+Xu7xRPCxZfk++05XyuMWNfHeDFG56qeLXJ6o/WEVqdlLzcFhLFwtjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740767353; c=relaxed/simple; bh=+vOIjyiiLtVaLNR4TkknfidJzzH1lydetnHTsM3M5Ko=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=JNf7Cd5UsHS4VxAoEIVOSksSi9i2grFb5iN14+qb6kdxy5ZAyttsMIbOYMcatrs1Rq3EyB4pfzsDP+NRRPwgTzBlSgyjXCBuilp2Rh3ZgfP62gSsev5bCJo4tPxwSCUUjjknyOEAIxuJtrknrpQxCoqQ0pr1UNnq6VBm0Z13gtY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PNVASr6Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PNVASr6Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F09C4CEE2; Fri, 28 Feb 2025 18:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740767352; bh=+vOIjyiiLtVaLNR4TkknfidJzzH1lydetnHTsM3M5Ko=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=PNVASr6Q63EkrDf9s+27lNtNmVKtsJzWvv86NgdeCb6HzXpZIGH7FV6FTggPTRUk1 qxevy5676b7NPXxA/pegE7MzsXwamHMpPFS9PkEcCmi78shuQ9Mf3uNCTlswXg0UYQ O4DU3vNNeM/8zZm87tbreJhZg0eqBeR7arejRYkfPz9deRbR/LOGVCh1dS0vKxTBJm /kLmNSXaS+BEIk1uwYzpa82PVitMKJEel8GtTYUMNnCP+KsOlKx7pfgolDXsQRpgx8 Jz/OljzlrOMvqX1KE0sIkrSiMSHQAIXpW90M8PpLr2+DmbG3yuRIA0OUKED0RpzzZK Ak+eCma6zMW6Q== From: Andreas Hindborg To: "Oliver Mangold" Cc: "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , "Benno Lossin" , "Alice Ryhl" , "Trevor Gross" , , Subject: Re: [PATCH v2] rust: adding UniqueRefCounted and UniqueRef types In-Reply-To: (Oliver Mangold's message of "Fri, 28 Feb 2025 18:01:55 +0000") References: User-Agent: mu4e 1.12.7; emacs 29.4 Date: Fri, 28 Feb 2025 19:29:02 +0100 Message-ID: <87frjxncsx.fsf@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Oliver Mangold" writes: > For usage with block-mq, a variant of ARef > which is guaranteed to be unique would be useful. > As chances are it is useful in general, This implements it > as kernel::types::UniqueRef. > The difference between ARef and UniqueRef > is basically the same as between Arc and UniqueArc. I would suggest splitting out the use case from the commit message: rust: add `UniqueRef` for `ARef` references Add `UniqeRef` as a variabt of `ARef` that is guaranteed to be unique. This is useful when mutable access to the underlying type is required and we can guarantee uniqueness, and when APIs that would normally take an `ARef` require uniqueness. --- Upcomming changes to the rust block device driver API depend on this patch. Please see [1] for a use casel. [1] https://github.com/metaspace/linux/blob/41034cb4ea7cd20b981ce320136b6526a9fa9db6/rust/kernel/block/mq/request.rs#L406 The comments after the --- will not got in the commit log, they are a message for the review process only. Best regards, Andreas Hindborg