btrfs: drop unused argument step from btrfs_free_extra_devids
authorAnand Jain <anand.jain@oracle.com>
Fri, 6 Nov 2020 08:06:33 +0000 (16:06 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:54:08 +0000 (15:54 +0100)
Commit cf89af146b7e ("btrfs: dev-replace: fail mount if we don't have
replace item with target device") dropped the multi stage operation of
btrfs_free_extra_devids() that does not need to check replace target
anymore and we can remove the 'step' argument.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index f0161d2ae2a46799f9d01bfe04a22d9b4611e592..8c87a1caefff19471d17298afaa980e0dfedae1c 100644 (file)
@@ -3149,11 +3149,13 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
        }
 
        /*
-        * Keep the devid that is marked to be the target device for the
-        * device replace procedure
+        * At this point we know all the devices that make this filesystem,
+        * including the seed devices but we don't know yet if the replace
+        * target is required. So free devices that are not part of this
+        * filesystem but skip the replace traget device which is checked
+        * below in btrfs_init_dev_replace().
         */
-       btrfs_free_extra_devids(fs_devices, 0);
-
+       btrfs_free_extra_devids(fs_devices);
        if (!fs_devices->latest_bdev) {
                btrfs_err(fs_info, "failed to read devices");
                goto fail_tree_roots;
@@ -3200,8 +3202,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
                goto fail_block_groups;
        }
 
-       btrfs_free_extra_devids(fs_devices, 1);
-
        ret = btrfs_sysfs_add_fsid(fs_devices);
        if (ret) {
                btrfs_err(fs_info, "failed to init sysfs fsid interface: %d",
index 998f25cddf2b215997e9a24633dd118b46f64e96..d7cc74f59293e794dc2518a38493af927789baf0 100644 (file)
@@ -1044,7 +1044,7 @@ error:
 }
 
 static void __btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices,
-                                     int step, struct btrfs_device **latest_dev)
+                                     struct btrfs_device **latest_dev)
 {
        struct btrfs_device *device, *next;
 
@@ -1089,16 +1089,16 @@ static void __btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices,
  * After we have read the system tree and know devids belonging to this
  * filesystem, remove the device which does not belong there.
  */
-void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step)
+void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices)
 {
        struct btrfs_device *latest_dev = NULL;
        struct btrfs_fs_devices *seed_dev;
 
        mutex_lock(&uuid_mutex);
-       __btrfs_free_extra_devids(fs_devices, step, &latest_dev);
+       __btrfs_free_extra_devids(fs_devices, &latest_dev);
 
        list_for_each_entry(seed_dev, &fs_devices->seed_list, seed_list)
-               __btrfs_free_extra_devids(seed_dev, step, &latest_dev);
+               __btrfs_free_extra_devids(seed_dev, &latest_dev);
 
        fs_devices->latest_bdev = latest_dev->bdev;
 
index 34fd440fd30b37fd865602073ed74a3a61ed66e7..7d1faf1c4ce4b66b0fd35ea0c650fcc4bb7b1b6d 100644 (file)
@@ -449,7 +449,7 @@ struct btrfs_device *btrfs_scan_one_device(const char *path,
                                           fmode_t flags, void *holder);
 int btrfs_forget_devices(const char *path);
 void btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
-void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step);
+void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices);
 void btrfs_assign_next_active_device(struct btrfs_device *device,
                                     struct btrfs_device *this_dev);
 struct btrfs_device *btrfs_find_device_by_devspec(struct btrfs_fs_info *fs_info,