summaryrefslogtreecommitdiff
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2018-01-18 22:02:34 +0800
committerDavid Sterba <dsterba@suse.com>2018-01-22 20:25:56 +0100
commitf2788d2f76cafef160e959999624c6a87e71d26d (patch)
tree273d7f9a70a5a3f0de2605daabe8d013cfb529f0 /fs/btrfs/volumes.c
parent327f18cc7f44bc09170200514f42e61bce25d022 (diff)
btrfs: set the total_devices in device_list_add()
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 46228e9312b2..4224a735493b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -841,6 +841,8 @@ static noinline int device_list_add(const char *path,
if (!fs_devices->opened)
device->generation = found_transid;
+ fs_devices->total_devices = btrfs_super_num_devices(disk_super);
+
*fs_devices_ret = fs_devices;
return 0;
@@ -1182,7 +1184,6 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
struct page *page;
int ret;
u64 devid;
- u64 total_devices;
u64 bytenr;
/*
@@ -1207,11 +1208,8 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
}
devid = btrfs_stack_device_id(&disk_super->dev_item);
- total_devices = btrfs_super_num_devices(disk_super);
ret = device_list_add(path, disk_super, devid, fs_devices_ret);
- if (!ret && fs_devices_ret)
- (*fs_devices_ret)->total_devices = total_devices;
btrfs_release_disk_super(page);