diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2013-08-12 07:33:01 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:16:03 -0400 |
commit | 53f10659f9994df8efe788f82d3da78d48e650c5 (patch) | |
tree | 897a1e95a990d0143b9850867fd7bf2c1649dfc8 /fs/btrfs | |
parent | bbb651e469d99f0088e286fdeb54acca7bb4ad4e (diff) |
Btrfs: find_next_devid: root -> fs_info
find_next_devid() knows which root to search, so it should take an
fs_info instead of an arbitrary root.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 75bdea6bf188..9b3595e370f8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1308,15 +1308,14 @@ static u64 find_next_chunk(struct btrfs_fs_info *fs_info) | |||
1308 | return ret; | 1308 | return ret; |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | static noinline int find_next_devid(struct btrfs_root *root, u64 *objectid) | 1311 | static noinline int find_next_devid(struct btrfs_fs_info *fs_info, |
1312 | u64 *devid_ret) | ||
1312 | { | 1313 | { |
1313 | int ret; | 1314 | int ret; |
1314 | struct btrfs_key key; | 1315 | struct btrfs_key key; |
1315 | struct btrfs_key found_key; | 1316 | struct btrfs_key found_key; |
1316 | struct btrfs_path *path; | 1317 | struct btrfs_path *path; |
1317 | 1318 | ||
1318 | root = root->fs_info->chunk_root; | ||
1319 | |||
1320 | path = btrfs_alloc_path(); | 1319 | path = btrfs_alloc_path(); |
1321 | if (!path) | 1320 | if (!path) |
1322 | return -ENOMEM; | 1321 | return -ENOMEM; |
@@ -1325,20 +1324,21 @@ static noinline int find_next_devid(struct btrfs_root *root, u64 *objectid) | |||
1325 | key.type = BTRFS_DEV_ITEM_KEY; | 1324 | key.type = BTRFS_DEV_ITEM_KEY; |
1326 | key.offset = (u64)-1; | 1325 | key.offset = (u64)-1; |
1327 | 1326 | ||
1328 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 1327 | ret = btrfs_search_slot(NULL, fs_info->chunk_root, &key, path, 0, 0); |
1329 | if (ret < 0) | 1328 | if (ret < 0) |
1330 | goto error; | 1329 | goto error; |
1331 | 1330 | ||
1332 | BUG_ON(ret == 0); /* Corruption */ | 1331 | BUG_ON(ret == 0); /* Corruption */ |
1333 | 1332 | ||
1334 | ret = btrfs_previous_item(root, path, BTRFS_DEV_ITEMS_OBJECTID, | 1333 | ret = btrfs_previous_item(fs_info->chunk_root, path, |
1334 | BTRFS_DEV_ITEMS_OBJECTID, | ||
1335 | BTRFS_DEV_ITEM_KEY); | 1335 | BTRFS_DEV_ITEM_KEY); |
1336 | if (ret) { | 1336 | if (ret) { |
1337 | *objectid = 1; | 1337 | *devid_ret = 1; |
1338 | } else { | 1338 | } else { |
1339 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, | 1339 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, |
1340 | path->slots[0]); | 1340 | path->slots[0]); |
1341 | *objectid = found_key.offset + 1; | 1341 | *devid_ret = found_key.offset + 1; |
1342 | } | 1342 | } |
1343 | ret = 0; | 1343 | ret = 0; |
1344 | error: | 1344 | error: |
@@ -1974,7 +1974,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1974 | } | 1974 | } |
1975 | rcu_assign_pointer(device->name, name); | 1975 | rcu_assign_pointer(device->name, name); |
1976 | 1976 | ||
1977 | ret = find_next_devid(root, &device->devid); | 1977 | ret = find_next_devid(root->fs_info, &device->devid); |
1978 | if (ret) { | 1978 | if (ret) { |
1979 | rcu_string_free(device->name); | 1979 | rcu_string_free(device->name); |
1980 | kfree(device); | 1980 | kfree(device); |