btrfs: Remove fs_info from btrfs_destroy_dev_replace_tgtdev
authorNikolay Borisov <nborisov@suse.com>
Fri, 20 Jul 2018 16:37:51 +0000 (19:37 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 11:12:57 +0000 (13:12 +0200)
This function is always passed a well-formed tgtdevice so the fs_info
can be referenced from there.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index dd17a4d7bea2d19995a73fd4f33752f0ffe530d3..5a72f9933e58233622fd5eea02f6d2b0322a80aa 100644 (file)
@@ -506,7 +506,7 @@ leave:
        dev_replace->srcdev = NULL;
        dev_replace->tgtdev = NULL;
        btrfs_dev_replace_write_unlock(dev_replace);
-       btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device);
+       btrfs_destroy_dev_replace_tgtdev(tgt_device);
        return ret;
 }
 
@@ -632,7 +632,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
                btrfs_rm_dev_replace_blocked(fs_info);
                if (tgt_device)
-                       btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device);
+                       btrfs_destroy_dev_replace_tgtdev(tgt_device);
                btrfs_rm_dev_replace_unblocked(fs_info);
                mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
 
@@ -821,7 +821,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
                btrfs_dev_name(tgt_device));
 
        if (tgt_device)
-               btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device);
+               btrfs_destroy_dev_replace_tgtdev(tgt_device);
 
 leave:
        mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
index 9cd15964ab6f8f946aa6e2c19690f5ced34c5435..45d7c37050ceec0ed38ecb49bc01878535b4c3db 100644 (file)
@@ -2063,10 +2063,9 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
        }
 }
 
-void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
-                                     struct btrfs_device *tgtdev)
+void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
 {
-       struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+       struct btrfs_fs_devices *fs_devices = tgtdev->fs_info->fs_devices;
 
        WARN_ON(!tgtdev);
        mutex_lock(&fs_devices->device_list_mutex);
index 1bcf0f34e8dcdb68eff6631052a518522b7478f1..69a028058c43f480764504476a076152d9a312d5 100644 (file)
@@ -455,8 +455,7 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans,
 void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_device *srcdev);
 void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
                                      struct btrfs_device *srcdev);
-void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
-                                     struct btrfs_device *tgtdev);
+void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev);
 void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_path);
 int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info,
                           u64 logical, u64 len);