summaryrefslogtreecommitdiff
path: root/volumes.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 /volumes.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 'volumes.c')
-rw-r--r--volumes.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/volumes.c b/volumes.c
index bdaca19..2c1bb62 100644
--- a/volumes.c
+++ b/volumes.c
@@ -585,7 +585,7 @@ error:
* the btrfs_device struct should be fully filled in
*/
int btrfs_add_device(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
+ struct btrfs_fs_info *fs_info,
struct btrfs_device *device)
{
int ret;
@@ -593,11 +593,10 @@ int btrfs_add_device(struct btrfs_trans_handle *trans,
struct btrfs_dev_item *dev_item;
struct extent_buffer *leaf;
struct btrfs_key key;
+ struct btrfs_root *root = fs_info->chunk_root;
unsigned long ptr;
u64 free_devid = 0;
- root = root->fs_info->chunk_root;
-
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
@@ -635,7 +634,7 @@ int btrfs_add_device(struct btrfs_trans_handle *trans,
ptr = (unsigned long)btrfs_device_uuid(dev_item);
write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE);
ptr = (unsigned long)btrfs_device_fsid(dev_item);
- write_extent_buffer(leaf, root->fs_info->fsid, ptr, BTRFS_UUID_SIZE);
+ write_extent_buffer(leaf, fs_info->fsid, ptr, BTRFS_UUID_SIZE);
btrfs_mark_buffer_dirty(leaf);
ret = 0;