Skip to content

Commit 5c3d057

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 bb6b619 commit 5c3d057

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
@@ -1927,7 +1927,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19271927

19281928
mutex_lock(&uuid_mutex);
19291929
btrfs_fs_devices_dec_holding(fs_devices);
1930-
ret = btrfs_open_devices(fs_devices, mode, &btrfs_fs_type);
1930+
ret = btrfs_open_devices(fs_devices, mode, sb);
19311931
if (ret < 0)
19321932
fs_info->fs_devices = NULL;
19331933
mutex_unlock(&uuid_mutex);
@@ -1942,7 +1942,6 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19421942
bdev = fs_devices->latest_dev->bdev;
19431943
snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
19441944
shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
1945-
btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
19461945
ret = btrfs_fill_super(sb, fs_devices);
19471946
if (ret) {
19481947
deactivate_locked_super(sb);

fs/btrfs/volumes.c

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

27072707
bdev_file = bdev_file_open_by_path(device_path, BLK_OPEN_WRITE,
2708-
fs_info->bdev_holder, NULL);
2708+
fs_info->sb, NULL);
27092709
if (IS_ERR(bdev_file))
27102710
return PTR_ERR(bdev_file);
27112711

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

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

0 commit comments

Comments
 (0)