Skip to content

Commit 29270af

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 136d210 commit 29270af

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

19211921
mutex_lock(&uuid_mutex);
19221922
btrfs_fs_devices_dec_holding(fs_devices);
1923-
ret = btrfs_open_devices(fs_devices, mode, &btrfs_fs_type);
1923+
ret = btrfs_open_devices(fs_devices, mode, sb);
19241924
mutex_unlock(&uuid_mutex);
19251925
if (ret < 0) {
19261926
deactivate_locked_super(sb);
@@ -1933,7 +1933,6 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19331933
bdev = fs_devices->latest_dev->bdev;
19341934
snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
19351935
shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
1936-
btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
19371936
ret = btrfs_fill_super(sb, fs_devices);
19381937
if (ret) {
19391938
deactivate_locked_super(sb);

fs/btrfs/volumes.c

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

27092709
bdev_file = bdev_file_open_by_path(device_path, BLK_OPEN_WRITE,
2710-
fs_info->bdev_holder, NULL);
2710+
fs_info->sb, NULL);
27112711
if (IS_ERR(bdev_file))
27122712
return PTR_ERR(bdev_file);
27132713

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

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

0 commit comments

Comments
 (0)