diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2017-06-13 17:19:33 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-07-12 17:53:54 +0200 |
commit | 9b3959d72a28079ed91d1028418dd17677cd3ffd (patch) | |
tree | 97c4bc98cd3f2c09fe78c67db8a230bb18c7808d /utils.c | |
parent | 7a36a1216bc72bd0feeb29d9caba14acf648de45 (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.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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: |