|
@@ -1107,38 +1107,6 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-static int __inode_info(u64 inum, u64 ioff, u8 key_type,
|
|
|
- struct btrfs_root *fs_root, struct btrfs_path *path,
|
|
|
- struct btrfs_key *found_key)
|
|
|
-{
|
|
|
- int ret;
|
|
|
- struct btrfs_key key;
|
|
|
- struct extent_buffer *eb;
|
|
|
-
|
|
|
- key.type = key_type;
|
|
|
- key.objectid = inum;
|
|
|
- key.offset = ioff;
|
|
|
-
|
|
|
- ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0);
|
|
|
- if (ret < 0)
|
|
|
- return ret;
|
|
|
-
|
|
|
- eb = path->nodes[0];
|
|
|
- if (ret && path->slots[0] >= btrfs_header_nritems(eb)) {
|
|
|
- ret = btrfs_next_leaf(fs_root, path);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
- eb = path->nodes[0];
|
|
|
- }
|
|
|
-
|
|
|
- btrfs_item_key_to_cpu(eb, found_key, path->slots[0]);
|
|
|
- if (found_key->type != key.type || found_key->objectid != key.objectid)
|
|
|
- return 1;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
* this makes the path point to (inum INODE_ITEM ioff)
|
|
|
*/
|
|
@@ -1146,16 +1114,16 @@ int inode_item_info(u64 inum, u64 ioff, struct btrfs_root *fs_root,
|
|
|
struct btrfs_path *path)
|
|
|
{
|
|
|
struct btrfs_key key;
|
|
|
- return __inode_info(inum, ioff, BTRFS_INODE_ITEM_KEY, fs_root, path,
|
|
|
- &key);
|
|
|
+ return btrfs_find_item(fs_root, path, inum, ioff,
|
|
|
+ BTRFS_INODE_ITEM_KEY, &key);
|
|
|
}
|
|
|
|
|
|
static int inode_ref_info(u64 inum, u64 ioff, struct btrfs_root *fs_root,
|
|
|
struct btrfs_path *path,
|
|
|
struct btrfs_key *found_key)
|
|
|
{
|
|
|
- return __inode_info(inum, ioff, BTRFS_INODE_REF_KEY, fs_root, path,
|
|
|
- found_key);
|
|
|
+ return btrfs_find_item(fs_root, path, inum, ioff,
|
|
|
+ BTRFS_INODE_REF_KEY, found_key);
|
|
|
}
|
|
|
|
|
|
int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
|