#ifndef __BTRFS_I__
 #define __BTRFS_I__
 
+/* in memory btrfs inode */
 struct btrfs_inode {
        struct btrfs_root *root;
        struct btrfs_block_group_cache *block_group;
 
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size);
        if (!ret) {
                ptr = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
 
        ret = btrfs_name_hash(name, name_len, &key.offset);
        BUG_ON(ret);
        path = btrfs_alloc_path();
-       btrfs_init_path(path);
        data_size = sizeof(*dir_item) + name_len;
        dir_item = insert_with_overflow(trans, root, path, &key, data_size,
                                        name, name_len);
 
                         &ins, 0);
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        key.objectid = blocknr;
        key.flags = 0;
        btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY);
        struct btrfs_extent_item *item;
 
        path = btrfs_alloc_path();
-       btrfs_init_path(path);
        key.objectid = blocknr;
        key.offset = num_blocks;
        key.flags = 0;
        find_free_extent(trans, root, 0, 0, (u64)-1, 0, &ins, 0);
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
 
        ret = btrfs_search_slot(trans, extent_root, &key, path, -1, 1);
        if (ret) {
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
 
        level = btrfs_header_level(btrfs_buffer_header(snap));
        orig_level = level;
 
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        file_key.objectid = objectid;
        file_key.offset = pos;
        file_key.flags = 0;
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        file_key.objectid = objectid;
        file_key.offset = offset;
        file_key.flags = 0;
 
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_insert_item(trans, root, &key, inode_item,
                                sizeof(*inode_item));
        btrfs_release_path(root, path);
 
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        mutex_lock(&root->fs_info->fs_mutex);
 
        memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_lookup_inode(trans, root, path,
                                 &BTRFS_I(inode)->location, 1);
        if (ret) {
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino,
                                    name, name_len, -1);
        if (IS_ERR(di)) {
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        mutex_lock(&root->fs_info->fs_mutex);
        trans = btrfs_start_transaction(root, 1);
        btrfs_set_trans_block_group(trans, dir);
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_lookup_inode(trans, root, path,
                                 &BTRFS_I(inode)->location, -1);
        BUG_ON(ret);
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name,
                                    namelen, 0);
        if (!di || IS_ERR(di)) {
        btrfs_set_key_type(&key, key_type);
        key.offset = filp->f_pos;
        path = btrfs_alloc_path();
-       btrfs_init_path(path);
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        if (ret < 0)
                goto err;
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        if (create & BTRFS_GET_BLOCK_CREATE) {
                WARN_ON(1);
                /* this almost but not quite works */
        }
 
        ret = btrfs_lookup_file_extent(NULL, root, path,
-                                      inode->i_ino,
+                                      objectid,
                                       iblock << inode->i_blkbits, 0);
        if (ret < 0) {
                err = ret;
 
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
        if (ret < 0)
                goto out;
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_search_slot(trans, root, key, path, 0, 1);
        if (ret < 0)
                goto out;
 
        path = btrfs_alloc_path();
        BUG_ON(!path);
-       btrfs_init_path(path);
        ret = btrfs_search_slot(trans, root, key, path, -1, 1);
        if (ret < 0)
                goto out;