u64 bytenr, u64 num_bytes);
 int btrfs_exclude_logged_extents(struct extent_buffer *eb);
 int btrfs_cross_ref_exist(struct btrfs_root *root,
-                         u64 objectid, u64 offset, u64 bytenr, bool strict);
+                         u64 objectid, u64 offset, u64 bytenr, bool strict,
+                         struct btrfs_path *path);
 struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
                                             struct btrfs_root *root,
                                             u64 parent, u64 root_objectid,
 
 }
 
 int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
-                         u64 bytenr, bool strict)
+                         u64 bytenr, bool strict, struct btrfs_path *path)
 {
-       struct btrfs_path *path;
        int ret;
 
-       path = btrfs_alloc_path();
-       if (!path)
-               return -ENOMEM;
-
        do {
                ret = check_committed_ref(root, path, objectid,
                                          offset, bytenr, strict);
        } while (ret == -EAGAIN);
 
 out:
-       btrfs_free_path(path);
+       btrfs_release_path(path);
        if (btrfs_is_data_reloc_root(root))
                WARN_ON(ret > 0);
        return ret;
 
 
                        ret = btrfs_cross_ref_exist(root, ino,
                                                    found_key.offset -
-                                                   extent_offset, disk_bytenr, false);
+                                                   extent_offset, disk_bytenr,
+                                                   false, path);
                        if (ret) {
                                /*
                                 * ret could be -EIO if the above fails to read
 
        ret = btrfs_cross_ref_exist(root, btrfs_ino(BTRFS_I(inode)),
                                    key.offset - backref_offset, disk_bytenr,
-                                   strict);
+                                   strict, path);
        if (ret) {
                ret = 0;
                goto out;