[PATCH 5/5] btrfs: use the super_block as holder when mounting file systems

From: Johannes Thumshirn
Date: Wed Feb 14 2024 - 11:44:09 EST


From: Christoph Hellwig <hch@xxxxxx>

The file system type is not a very useful holder as it doesn't allow us
to go back to the actual file system instance. Pass the super_block
instead which is useful when passed back to the file system driver.

This matches what is done for all other block device based file systems.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
---
fs/btrfs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 1fa7d83d02c1..0c7956e8f21e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1843,7 +1843,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;

mutex_lock(&uuid_mutex);
- ret = btrfs_open_devices(fs_devices, mode, &btrfs_fs_type);
+ ret = btrfs_open_devices(fs_devices, mode, sb);
mutex_unlock(&uuid_mutex);
if (ret)
goto error_deactivate;
@@ -1856,7 +1856,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
snprintf(sb->s_id, sizeof(sb->s_id), "%pg",
fs_devices->latest_dev->bdev);
shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
- btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
+ btrfs_sb(sb)->bdev_holder = sb;
ret = btrfs_fill_super(sb, fs_devices, NULL);
if (ret)
goto error_deactivate;

--
2.43.0