Commit 1cdeac6d authored by David Sterba's avatar David Sterba

btrfs: pass btrfs_device to btrfs_scratch_superblocks()

Replace the two parameters bdev and name by one that can be used to get
them both.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 37bf7718
...@@ -998,8 +998,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, ...@@ -998,8 +998,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
btrfs_sysfs_remove_device(src_device); btrfs_sysfs_remove_device(src_device);
btrfs_sysfs_update_devid(tgt_device); btrfs_sysfs_update_devid(tgt_device);
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &src_device->dev_state)) if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &src_device->dev_state))
btrfs_scratch_superblocks(fs_info, src_device->bdev, btrfs_scratch_superblocks(fs_info, src_device);
src_device->name->str);
/* write back the superblocks */ /* write back the superblocks */
trans = btrfs_start_transaction(root, 0); trans = btrfs_start_transaction(root, 0);
......
...@@ -2030,11 +2030,10 @@ static void btrfs_scratch_superblock(struct btrfs_fs_info *fs_info, ...@@ -2030,11 +2030,10 @@ static void btrfs_scratch_superblock(struct btrfs_fs_info *fs_info,
copy_num, ret); copy_num, ret);
} }
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, struct btrfs_device *device)
struct block_device *bdev,
const char *device_path)
{ {
int copy_num; int copy_num;
struct block_device *bdev = device->bdev;
if (!bdev) if (!bdev)
return; return;
...@@ -2050,7 +2049,7 @@ void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, ...@@ -2050,7 +2049,7 @@ void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
btrfs_kobject_uevent(bdev, KOBJ_CHANGE); btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
/* Update ctime/mtime for device path for libblkid */ /* Update ctime/mtime for device path for libblkid */
update_dev_time(device_path); update_dev_time(device->name->str);
} }
int btrfs_rm_device(struct btrfs_fs_info *fs_info, int btrfs_rm_device(struct btrfs_fs_info *fs_info,
...@@ -2185,8 +2184,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, ...@@ -2185,8 +2184,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info,
* device and let the caller do the final bdev_release. * device and let the caller do the final bdev_release.
*/ */
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) { if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) {
btrfs_scratch_superblocks(fs_info, device->bdev, btrfs_scratch_superblocks(fs_info, device);
device->name->str);
if (device->bdev) { if (device->bdev) {
sync_blockdev(device->bdev); sync_blockdev(device->bdev);
invalidate_bdev(device->bdev); invalidate_bdev(device->bdev);
...@@ -2299,8 +2297,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev) ...@@ -2299,8 +2297,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
mutex_unlock(&fs_devices->device_list_mutex); mutex_unlock(&fs_devices->device_list_mutex);
btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev->bdev, btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev);
tgtdev->name->str);
btrfs_close_bdev(tgtdev); btrfs_close_bdev(tgtdev);
synchronize_rcu(); synchronize_rcu();
......
...@@ -817,9 +817,7 @@ void btrfs_commit_device_sizes(struct btrfs_transaction *trans); ...@@ -817,9 +817,7 @@ void btrfs_commit_device_sizes(struct btrfs_transaction *trans);
struct list_head * __attribute_const__ btrfs_get_fs_uuids(void); struct list_head * __attribute_const__ btrfs_get_fs_uuids(void);
bool btrfs_check_rw_degradable(struct btrfs_fs_info *fs_info, bool btrfs_check_rw_degradable(struct btrfs_fs_info *fs_info,
struct btrfs_device *failing_dev); struct btrfs_device *failing_dev);
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, struct btrfs_device *device);
struct block_device *bdev,
const char *device_path);
enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags); enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags);
int btrfs_bg_type_to_factor(u64 flags); int btrfs_bg_type_to_factor(u64 flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment