summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-06-13 17:19:33 +0800
committerDavid Sterba <dsterba@suse.com>2017-07-12 17:53:54 +0200
commit9b3959d72a28079ed91d1028418dd17677cd3ffd (patch)
tree97c4bc98cd3f2c09fe78c67db8a230bb18c7808d /utils.c
parent7a36a1216bc72bd0feeb29d9caba14acf648de45 (diff)
btrfs-progs: Refactor btrfs_add_device() to use btrfs_fs_info
BTW, there is a duplicated definition of btrfs_add_device() in volumes.h, also remove it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/utils.c b/utils.c
index 823b7f3d..243ee1e5 100644
--- a/utils.c
+++ b/utils.c
@@ -179,7 +179,8 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
u32 sectorsize)
{
struct btrfs_super_block *disk_super;
- struct btrfs_super_block *super = root->fs_info->super_copy;
+ struct btrfs_fs_info *fs_info = root->fs_info;
+ struct btrfs_super_block *super = fs_info->super_copy;
struct btrfs_device *device;
struct btrfs_dev_item *dev_item;
char *buf = NULL;
@@ -214,7 +215,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
device->total_bytes = device_total_bytes;
device->bytes_used = 0;
device->total_ios = 0;
- device->dev_root = root->fs_info->dev_root;
+ device->dev_root = fs_info->dev_root;
device->name = strdup(path);
if (!device->name) {
ret = -ENOMEM;
@@ -222,7 +223,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
}
INIT_LIST_HEAD(&device->dev_list);
- ret = btrfs_add_device(trans, root, device);
+ ret = btrfs_add_device(trans, fs_info, device);
if (ret)
goto out;
@@ -248,8 +249,8 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
BUG_ON(ret != sectorsize);
free(buf);
- list_add(&device->dev_list, &root->fs_info->fs_devices->devices);
- device->fs_devices = root->fs_info->fs_devices;
+ list_add(&device->dev_list, &fs_info->fs_devices->devices);
+ device->fs_devices = fs_info->fs_devices;
return 0;
out: