[PATCH 06/17] btrfs: use the super_block as holder when mounting file systems
- To: Al Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>
- Cc: Jens Axboe <axboe@kernel.dk>, Denis Efremov <efremov@linux.com>, Josef Bacik <josef@toxicpanda.com>, Stefan Haberland <sth@linux.ibm.com>, Jan Hoeppner <hoeppner@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, "Darrick J . Wong" <djwong@kernel.org>, Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>, linux-block@vger.kernel.org, nbd@other.debian.org, linux-s390@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Subject: [PATCH 06/17] btrfs: use the super_block as holder when mounting file systems
- From: Christoph Hellwig <hch@lst.de>
- Date: Fri, 11 Aug 2023 12:08:17 +0200
- Message-id: <[🔎] 20230811100828.1897174-7-hch@lst.de>
- In-reply-to: <[🔎] 20230811100828.1897174-1-hch@lst.de>
- References: <[🔎] 20230811100828.1897174-1-hch@lst.de>
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@lst.de>
---
fs/btrfs/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 1079a0f541790d..0f7c402fb40349 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -69,8 +69,6 @@ static const struct super_operations btrfs_super_ops;
* requested by subvol=/path. That way the callchain is straightforward and we
* don't have to play tricks with the mount options and recursive calls to
* btrfs_mount.
- *
- * The new btrfs_root_fs_type also servers as a tag for the bdev_holder.
*/
static struct file_system_type btrfs_fs_type;
static struct file_system_type btrfs_root_fs_type;
@@ -1503,8 +1501,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
mutex_lock(&uuid_mutex);
- error = btrfs_open_devices(fs_devices, sb_open_mode(flags),
- fs_type);
+ error = btrfs_open_devices(fs_devices, sb_open_mode(flags), s);
mutex_unlock(&uuid_mutex);
if (error)
goto error_deactivate;
@@ -1518,7 +1515,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
fs_devices->latest_dev->bdev);
shrinker_debugfs_rename(&s->s_shrink, "sb-%s:%s", fs_type->name,
s->s_id);
- btrfs_sb(s)->bdev_holder = fs_type;
+ btrfs_sb(s)->bdev_holder = s;
error = btrfs_fill_super(s, fs_devices, data);
}
if (!error)
--
2.39.2
Reply to: