btrfs: btrfs_init_new_device should use fs_info->dev_root
authorJeff Mahoney <jeffm@suse.com>
Wed, 22 Jun 2016 00:16:08 +0000 (20:16 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 6 Dec 2016 15:06:57 +0000 (16:06 +0100)
btrfs_init_new_device only uses the root passed in via the ioctl to
start the transaction.  Nothing else that happens is related to whatever
root the user used to initiate the ioctl.  We can drop the root requirement
and just use fs_info->dev_root instead.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index 67c37fdd00dcd0069064fe68b23dd9174f44b5ef..5b21a9bcfe811f8c7ec5a5ca301e011af93fbb05 100644 (file)
@@ -2672,7 +2672,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
        }
 
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
-       ret = btrfs_init_new_device(root, vol_args->name);
+       ret = btrfs_init_new_device(root->fs_info, vol_args->name);
 
        if (!ret)
                btrfs_info(root->fs_info, "disk added %s",vol_args->name);
index 99a81369e43ddb992322fbd7df73bc9dd3a250a0..1622dc7eab9195ef2886c1808029c6d26e56a69e 100644 (file)
@@ -2310,8 +2310,9 @@ error:
        return ret;
 }
 
-int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
+int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *device_path)
 {
+       struct btrfs_root *root = fs_info->dev_root;
        struct request_queue *q;
        struct btrfs_trans_handle *trans;
        struct btrfs_device *device;
index 471a619787e8a3da9b252f3ac352723f8fee4648..0c8e77bfa8f62a322aedf7bcc45bcf900cc63a5f 100644 (file)
@@ -439,7 +439,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans,
 struct btrfs_device *btrfs_find_device(struct btrfs_fs_info *fs_info, u64 devid,
                                       u8 *uuid, u8 *fsid);
 int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
-int btrfs_init_new_device(struct btrfs_root *root, char *path);
+int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *path);
 int btrfs_init_dev_replace_tgtdev(struct btrfs_root *root, char *device_path,
                                  struct btrfs_device *srcdev,
                                  struct btrfs_device **device_out);