|
@@ -2609,32 +2609,23 @@ static int key_search(struct extent_buffer *b, struct btrfs_key *key,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path,
|
|
|
+int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path,
|
|
|
u64 iobjectid, u64 ioff, u8 key_type,
|
|
|
struct btrfs_key *found_key)
|
|
|
{
|
|
|
int ret;
|
|
|
struct btrfs_key key;
|
|
|
struct extent_buffer *eb;
|
|
|
- struct btrfs_path *path;
|
|
|
+
|
|
|
+ ASSERT(path);
|
|
|
|
|
|
key.type = key_type;
|
|
|
key.objectid = iobjectid;
|
|
|
key.offset = ioff;
|
|
|
|
|
|
- if (found_path == NULL) {
|
|
|
- path = btrfs_alloc_path();
|
|
|
- if (!path)
|
|
|
- return -ENOMEM;
|
|
|
- } else
|
|
|
- path = found_path;
|
|
|
-
|
|
|
ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0);
|
|
|
- if ((ret < 0) || (found_key == NULL)) {
|
|
|
- if (path != found_path)
|
|
|
- btrfs_free_path(path);
|
|
|
+ if ((ret < 0) || (found_key == NULL))
|
|
|
return ret;
|
|
|
- }
|
|
|
|
|
|
eb = path->nodes[0];
|
|
|
if (ret && path->slots[0] >= btrfs_header_nritems(eb)) {
|