Skip to content

Commit b9b7ddd

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

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
@@ -473,7 +473,7 @@ btrfs_get_bdev_and_sb(const char *device_path, blk_mode_t flags, void *holder,
473473
struct block_device *bdev;
474474
int ret;
475475

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

478478
if (IS_ERR(*bdev_file)) {
479479
ret = PTR_ERR(*bdev_file);
@@ -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->sb, NULL);
2708+
fs_info->sb, &fs_holder_ops);
27092709
if (IS_ERR(bdev_file))
27102710
return PTR_ERR(bdev_file);
27112711

0 commit comments

Comments
 (0)