[PATCH 61/79] block: rust: add `GenDisk::tag_set`

Andreas Hindborg
2026-02-15T23:45:21Z

Add a method to `GenDisk` to obtain a reference to the associated `TagSet`.

Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
rust/kernel/block/mq/gen_disk.rs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index c6b9839864012..b5291bc3e051d 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -236,7 +236,7 @@ pub fn build(
// `__blk_mq_alloc_disk` above.
let mut disk = UniqueArc::new(
GenDisk {
- _tagset: tagset,
+ tag_set: tagset,
gendisk,
backref: Arc::pin_init(
// INVARIANT: We break `GenDiskRef` invariant here, but we restore it below.
@@ -320,7 +320,7 @@ pub(crate) const fn build_vtable() -> &'static bindings::block_device_operations
/// `bindings::device_add_disk`.
/// - `self.gendisk.queue.queuedata` is initialized by a call to `ForeignOwnable::into_foreign`.
pub struct GenDisk<T: Operations> {
- _tagset: Arc<TagSet<T>>,
+ tag_set: Arc<TagSet<T>>,
gendisk: *mut bindings::gendisk,
backref: Arc<Revocable<GenDiskRef<T>>>,
}
@@ -342,6 +342,11 @@ pub fn queue_data(&self) -> <T::QueueData as ForeignOwnable>::Borrowed<'_> {
// SAFETY: By type invariant, self is a valid gendisk.
unsafe { T::QueueData::borrow((*(*self.gendisk).queue).queuedata) }
}
+
+ /// Get a reference to the `TagSet` used by this `GenDisk`.
+ pub fn tag_set(&self) -> &Arc<TagSet<T>> {
+ &self.tag_set
+ }
}

// SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a

--
2.51.2