Skip to content

Commit 938f8b9

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: use the super_block as holder when mounting file systems
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, and allows us to remove btrfs_fs_info::bdev_holder completely. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 7ba4eda commit 938f8b9

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

fs/btrfs/dev-replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
250250
}
251251

252252
bdev_file = bdev_file_open_by_path(device_path, BLK_OPEN_WRITE,
253-
fs_info->bdev_holder, NULL);
253+
fs_info->sb, NULL);
254254
if (IS_ERR(bdev_file)) {
255255
btrfs_err(fs_info, "target device %s is invalid!", device_path);
256256
return PTR_ERR(bdev_file);

fs/btrfs/fs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,6 @@ struct btrfs_fs_info {
715715
u32 data_chunk_allocations;
716716
u32 metadata_ratio;
717717

718-
void *bdev_holder;
719-
720718
/* Private scrub information */
721719
struct mutex scrub_lock;
722720
atomic_t scrubs_running;

fs/btrfs/super.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19061906
*/
19071907
ASSERT(fc->s_fs_info == NULL);
19081908

1909-
ret = btrfs_open_devices(fs_devices, mode, &btrfs_fs_type);
1909+
ret = btrfs_open_devices(fs_devices, mode, sb);
19101910
mutex_unlock(&uuid_mutex);
19111911
if (ret < 0) {
19121912
deactivate_locked_super(sb);
@@ -1919,7 +1919,6 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19191919
bdev = fs_devices->latest_dev->bdev;
19201920
snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
19211921
shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
1922-
btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
19231922
ret = btrfs_fill_super(sb, fs_devices);
19241923
if (ret) {
19251924
deactivate_locked_super(sb);

fs/btrfs/volumes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
27062706
return -EROFS;
27072707

27082708
bdev_file = bdev_file_open_by_path(device_path, BLK_OPEN_WRITE,
2709-
fs_info->bdev_holder, NULL);
2709+
fs_info->sb, NULL);
27102710
if (IS_ERR(bdev_file))
27112711
return PTR_ERR(bdev_file);
27122712

@@ -7175,7 +7175,7 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info,
71757175
if (IS_ERR(fs_devices))
71767176
return fs_devices;
71777177

7178-
ret = open_fs_devices(fs_devices, BLK_OPEN_READ, fs_info->bdev_holder);
7178+
ret = open_fs_devices(fs_devices, BLK_OPEN_READ, fs_info->sb);
71797179
if (ret) {
71807180
free_fs_devices(fs_devices);
71817181
return ERR_PTR(ret);

0 commit comments

Comments
 (0)