Skip to content

Commit 419de65

Browse files
adam900710kdave
authored andcommitted
btrfs: use fs_holder_ops for all opened devices
Since we have btrfs_fs_info::sb (struct super_block) as our block device holder, we can safely use fs_holder_ops for all of our block devices. This enables freezing/thawing the btrfs from the underlying block devices. This may enhance hibernation/suspension support since previously freezing/thawing a block device managed by btrfs won't do anything btrfs specific, but only syncing the block device. Thus before this change, freezing the underlying block devices won't prevent future writes into the btrfs, thus may cause problems for hibernation/suspension when btrfs is involved. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 29270af commit 419de65

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
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->sb, NULL);
253+
fs_info->sb, &fs_holder_ops);
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/volumes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ btrfs_get_bdev_and_sb(const char *device_path, blk_mode_t flags, void *holder,
475475
struct block_device *bdev;
476476
int ret;
477477

478-
*bdev_file = bdev_file_open_by_path(device_path, flags, holder, NULL);
478+
*bdev_file = bdev_file_open_by_path(device_path, flags, holder, &fs_holder_ops);
479479

480480
if (IS_ERR(*bdev_file)) {
481481
ret = PTR_ERR(*bdev_file);
@@ -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->sb, NULL);
2710+
fs_info->sb, &fs_holder_ops);
27112711
if (IS_ERR(bdev_file))
27122712
return PTR_ERR(bdev_file);
27132713

0 commit comments

Comments
 (0)