btrfs: Make __add_inode_ref take btrfs_inode
[linux-2.6-block.git] / fs / btrfs / tree-log.c
index 6f9a3beb7050f566f53dbd64bdbf49be8093ab37..5b164ccbb3c09d2f9337a5166ce875b09a5f3eca 100644 (file)
@@ -843,7 +843,7 @@ out:
 static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
                                      struct btrfs_root *root,
                                      struct btrfs_path *path,
-                                     struct inode *dir,
+                                     struct btrfs_inode *dir,
                                      struct btrfs_dir_item *di)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
@@ -875,7 +875,8 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
        if (ret)
                goto out;
 
-       ret = btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
+       ret = btrfs_unlink_inode(trans, root, dir, BTRFS_I(inode), name,
+                       name_len);
        if (ret)
                goto out;
        else
@@ -991,7 +992,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
                                  struct btrfs_root *root,
                                  struct btrfs_path *path,
                                  struct btrfs_root *log_root,
-                                 struct inode *dir, struct inode *inode,
+                                 struct btrfs_inode *dir,
+                                 struct btrfs_inode *inode,
                                  struct extent_buffer *eb,
                                  u64 inode_objectid, u64 parent_objectid,
                                  u64 ref_index, char *name, int namelen,
@@ -1047,12 +1049,11 @@ again:
                                            parent_objectid,
                                            victim_name,
                                            victim_name_len)) {
-                               inc_nlink(inode);
+                               inc_nlink(&inode->vfs_inode);
                                btrfs_release_path(path);
 
-                               ret = btrfs_unlink_inode(trans, root, dir,
-                                                        inode, victim_name,
-                                                        victim_name_len);
+                               ret = btrfs_unlink_inode(trans, root, dir, inode,
+                                               victim_name, victim_name_len);
                                kfree(victim_name);
                                if (ret)
                                        return ret;
@@ -1115,16 +1116,16 @@ again:
                                            victim_name_len)) {
                                ret = -ENOENT;
                                victim_parent = read_one_inode(root,
-                                                              parent_objectid);
+                                               parent_objectid);
                                if (victim_parent) {
-                                       inc_nlink(inode);
+                                       inc_nlink(&inode->vfs_inode);
                                        btrfs_release_path(path);
 
                                        ret = btrfs_unlink_inode(trans, root,
-                                                                victim_parent,
-                                                                inode,
-                                                                victim_name,
-                                                                victim_name_len);
+                                                       BTRFS_I(victim_parent),
+                                                       inode,
+                                                       victim_name,
+                                                       victim_name_len);
                                        if (!ret)
                                                ret = btrfs_run_delayed_items(
                                                                  trans,
@@ -1148,7 +1149,7 @@ next:
        btrfs_release_path(path);
 
        /* look for a conflicting sequence number */
-       di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+       di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir),
                                         ref_index, name, namelen, 0);
        if (di && !IS_ERR(di)) {
                ret = drop_one_dir_item(trans, root, path, dir, di);
@@ -1158,7 +1159,7 @@ next:
        btrfs_release_path(path);
 
        /* look for a conflicing name */
-       di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+       di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir),
                                   name, namelen, 0);
        if (di && !IS_ERR(di)) {
                ret = drop_one_dir_item(trans, root, path, dir, di);
@@ -1307,7 +1308,8 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 
                        if (!search_done) {
                                ret = __add_inode_ref(trans, root, path, log,
-                                                     dir, inode, eb,
+                                                     BTRFS_I(dir),
+                                                     BTRFS_I(inode), eb,
                                                      inode_objectid,
                                                      parent_objectid,
                                                      ref_index, name, namelen,
@@ -1769,7 +1771,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
        if (!exists)
                goto out;
 
-       ret = drop_one_dir_item(trans, root, path, dir, dst_di);
+       ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), dst_di);
        if (ret)
                goto out;
 
@@ -2052,8 +2054,8 @@ again:
                        }
 
                        inc_nlink(inode);
-                       ret = btrfs_unlink_inode(trans, root, dir, inode,
-                                                name, name_len);
+                       ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
+                                       BTRFS_I(inode), name, name_len);
                        if (!ret)
                                ret = btrfs_run_delayed_items(trans, fs_info);
                        kfree(name);
@@ -3084,7 +3086,7 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
 int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
                                 struct btrfs_root *root,
                                 const char *name, int name_len,
-                                struct inode *dir, u64 index)
+                                struct btrfs_inode *dir, u64 index)
 {
        struct btrfs_root *log;
        struct btrfs_dir_item *di;
@@ -3092,16 +3094,16 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
        int ret;
        int err = 0;
        int bytes_del = 0;
-       u64 dir_ino = btrfs_ino(BTRFS_I(dir));
+       u64 dir_ino = btrfs_ino(dir);
 
-       if (BTRFS_I(dir)->logged_trans < trans->transid)
+       if (dir->logged_trans < trans->transid)
                return 0;
 
        ret = join_running_log_trans(root);
        if (ret)
                return 0;
 
-       mutex_lock(&BTRFS_I(dir)->log_mutex);
+       mutex_lock(&dir->log_mutex);
 
        log = root->log_root;
        path = btrfs_alloc_path();
@@ -3176,7 +3178,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
 fail:
        btrfs_free_path(path);
 out_unlock:
-       mutex_unlock(&BTRFS_I(dir)->log_mutex);
+       mutex_unlock(&dir->log_mutex);
        if (ret == -ENOSPC) {
                btrfs_set_log_full_commit(root->fs_info, trans);
                ret = 0;
@@ -3192,25 +3194,25 @@ out_unlock:
 int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
                               struct btrfs_root *root,
                               const char *name, int name_len,
-                              struct inode *inode, u64 dirid)
+                              struct btrfs_inode *inode, u64 dirid)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_root *log;
        u64 index;
        int ret;
 
-       if (BTRFS_I(inode)->logged_trans < trans->transid)
+       if (inode->logged_trans < trans->transid)
                return 0;
 
        ret = join_running_log_trans(root);
        if (ret)
                return 0;
        log = root->log_root;
-       mutex_lock(&BTRFS_I(inode)->log_mutex);
+       mutex_lock(&inode->log_mutex);
 
-       ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(BTRFS_I(inode)),
+       ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(inode),
                                  dirid, &index);
-       mutex_unlock(&BTRFS_I(inode)->log_mutex);
+       mutex_unlock(&inode->log_mutex);
        if (ret == -ENOSPC) {
                btrfs_set_log_full_commit(fs_info, trans);
                ret = 0;
@@ -3260,7 +3262,7 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans,
  * to replay anything deleted before the fsync
  */
 static noinline int log_dir_items(struct btrfs_trans_handle *trans,
-                         struct btrfs_root *root, struct inode *inode,
+                         struct btrfs_root *root, struct btrfs_inode *inode,
                          struct btrfs_path *path,
                          struct btrfs_path *dst_path, int key_type,
                          struct btrfs_log_ctx *ctx,
@@ -3275,7 +3277,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
        int nritems;
        u64 first_offset = min_offset;
        u64 last_offset = (u64)-1;
-       u64 ino = btrfs_ino(BTRFS_I(inode));
+       u64 ino = btrfs_ino(inode);
 
        log = root->log_root;
 
@@ -3450,7 +3452,7 @@ done:
  * key logged by this transaction.
  */
 static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
-                         struct btrfs_root *root, struct inode *inode,
+                         struct btrfs_root *root, struct btrfs_inode *inode,
                          struct btrfs_path *path,
                          struct btrfs_path *dst_path,
                          struct btrfs_log_ctx *ctx)
@@ -3464,9 +3466,8 @@ again:
        min_key = 0;
        max_key = 0;
        while (1) {
-               ret = log_dir_items(trans, root, inode, path,
-                                   dst_path, key_type, ctx, min_key,
-                                   &max_key);
+               ret = log_dir_items(trans, root, inode, path, dst_path, key_type,
+                               ctx, min_key, &max_key);
                if (ret)
                        return ret;
                if (max_key == (u64)-1)
@@ -3613,16 +3614,16 @@ static int log_inode_item(struct btrfs_trans_handle *trans,
 }
 
 static noinline int copy_items(struct btrfs_trans_handle *trans,
-                              struct inode *inode,
+                              struct btrfs_inode *inode,
                               struct btrfs_path *dst_path,
                               struct btrfs_path *src_path, u64 *last_extent,
                               int start_slot, int nr, int inode_only,
                               u64 logged_isize)
 {
-       struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+       struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
        unsigned long src_offset;
        unsigned long dst_offset;
-       struct btrfs_root *log = BTRFS_I(inode)->root->log_root;
+       struct btrfs_root *log = inode->root->log_root;
        struct btrfs_file_extent_item *extent;
        struct btrfs_inode_item *inode_item;
        struct extent_buffer *src = src_path->nodes[0];
@@ -3633,7 +3634,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
        char *ins_data;
        int i;
        struct list_head ordered_sums;
-       int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
+       int skip_csum = inode->flags & BTRFS_INODE_NODATASUM;
        bool has_extents = false;
        bool need_find_last_extent = true;
        bool done = false;
@@ -3675,7 +3676,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
                                                    dst_path->slots[0],
                                                    struct btrfs_inode_item);
                        fill_inode_item(trans, dst_path->nodes[0], inode_item,
-                                       inode, inode_only == LOG_INODE_EXISTS,
+                                       &inode->vfs_inode, inode_only == LOG_INODE_EXISTS,
                                        logged_isize);
                } else {
                        copy_extent_buffer(dst_path->nodes[0], src, dst_offset,
@@ -3783,7 +3784,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
        if (need_find_last_extent) {
                u64 len;
 
-               ret = btrfs_prev_leaf(BTRFS_I(inode)->root, src_path);
+               ret = btrfs_prev_leaf(inode->root, src_path);
                if (ret < 0)
                        return ret;
                if (ret)
@@ -3792,7 +3793,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
                        src_path->slots[0]--;
                src = src_path->nodes[0];
                btrfs_item_key_to_cpu(src, &key, src_path->slots[0]);
-               if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+               if (key.objectid != btrfs_ino(inode) ||
                    key.type != BTRFS_EXTENT_DATA_KEY)
                        goto fill_holes;
                extent = btrfs_item_ptr(src, src_path->slots[0],
@@ -3825,8 +3826,7 @@ fill_holes:
        if (need_find_last_extent) {
                /* btrfs_prev_leaf could return 1 without releasing the path */
                btrfs_release_path(src_path);
-               ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &first_key,
-                                       src_path, 0, 0);
+               ret = btrfs_search_slot(NULL, inode->root, &first_key, src_path, 0, 0);
                if (ret < 0)
                        return ret;
                ASSERT(ret == 0);
@@ -3846,7 +3846,7 @@ fill_holes:
                u64 extent_end;
 
                if (i >= btrfs_header_nritems(src_path->nodes[0])) {
-                       ret = btrfs_next_leaf(BTRFS_I(inode)->root, src_path);
+                       ret = btrfs_next_leaf(inode->root, src_path);
                        if (ret < 0)
                                return ret;
                        ASSERT(ret == 0);
@@ -3857,7 +3857,7 @@ fill_holes:
                btrfs_item_key_to_cpu(src, &key, i);
                if (!btrfs_comp_cpu_keys(&key, &last_key))
                        done = true;
-               if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+               if (key.objectid != btrfs_ino(inode) ||
                    key.type != BTRFS_EXTENT_DATA_KEY) {
                        i++;
                        continue;
@@ -3880,9 +3880,8 @@ fill_holes:
                }
                offset = *last_extent;
                len = key.offset - *last_extent;
-               ret = btrfs_insert_file_extent(trans, log, btrfs_ino(BTRFS_I(inode)),
-                                              offset, 0, 0, len, 0, len, 0,
-                                              0, 0);
+               ret = btrfs_insert_file_extent(trans, log, btrfs_ino(inode),
+                                              offset, 0, 0, len, 0, len, 0, 0, 0);
                if (ret)
                        break;
                *last_extent = extent_end;
@@ -4055,7 +4054,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans,
 }
 
 static int log_one_extent(struct btrfs_trans_handle *trans,
-                         struct inode *inode, struct btrfs_root *root,
+                         struct btrfs_inode *inode, struct btrfs_root *root,
                          const struct extent_map *em,
                          struct btrfs_path *path,
                          const struct list_head *logged_list,
@@ -4072,7 +4071,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
        int extent_inserted = 0;
        bool ordered_io_err = false;
 
-       ret = wait_ordered_extents(trans, inode, root, em, logged_list,
+       ret = wait_ordered_extents(trans, &inode->vfs_inode, root, em, logged_list,
                                   &ordered_io_err);
        if (ret)
                return ret;
@@ -4084,14 +4083,14 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
 
        btrfs_init_map_token(&token);
 
-       ret = __btrfs_drop_extents(trans, log, inode, path, em->start,
+       ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start,
                                   em->start + em->len, NULL, 0, 1,
                                   sizeof(*fi), &extent_inserted);
        if (ret)
                return ret;
 
        if (!extent_inserted) {
-               key.objectid = btrfs_ino(BTRFS_I(inode));
+               key.objectid = btrfs_ino(inode);
                key.type = BTRFS_EXTENT_DATA_KEY;
                key.offset = em->start;
 
@@ -4150,7 +4149,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
 
 static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
                                     struct btrfs_root *root,
-                                    struct inode *inode,
+                                    struct btrfs_inode *inode,
                                     struct btrfs_path *path,
                                     struct list_head *logged_list,
                                     struct btrfs_log_ctx *ctx,
@@ -4159,14 +4158,14 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
 {
        struct extent_map *em, *n;
        struct list_head extents;
-       struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
+       struct extent_map_tree *tree = &inode->extent_tree;
        u64 test_gen;
        int ret = 0;
        int num = 0;
 
        INIT_LIST_HEAD(&extents);
 
-       down_write(&BTRFS_I(inode)->dio_sem);
+       down_write(&inode->dio_sem);
        write_lock(&tree->lock);
        test_gen = root->fs_info->last_trans_committed;
 
@@ -4206,7 +4205,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
         * without writing to the log tree and the fsync must report the
         * file data write error and not commit the current transaction.
         */
-       ret = filemap_check_errors(inode->i_mapping);
+       ret = filemap_check_errors(inode->vfs_inode.i_mapping);
        if (ret)
                ctx->io_err = ret;
 process:
@@ -4235,19 +4234,19 @@ process:
        }
        WARN_ON(!list_empty(&extents));
        write_unlock(&tree->lock);
-       up_write(&BTRFS_I(inode)->dio_sem);
+       up_write(&inode->dio_sem);
 
        btrfs_release_path(path);
        return ret;
 }
 
-static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
+static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
                             struct btrfs_path *path, u64 *size_ret)
 {
        struct btrfs_key key;
        int ret;
 
-       key.objectid = btrfs_ino(BTRFS_I(inode));
+       key.objectid = btrfs_ino(inode);
        key.type = BTRFS_INODE_ITEM_KEY;
        key.offset = 0;
 
@@ -4279,13 +4278,13 @@ static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
  */
 static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
                                struct btrfs_root *root,
-                               struct inode *inode,
+                               struct btrfs_inode *inode,
                                struct btrfs_path *path,
                                struct btrfs_path *dst_path)
 {
        int ret;
        struct btrfs_key key;
-       const u64 ino = btrfs_ino(BTRFS_I(inode));
+       const u64 ino = btrfs_ino(inode);
        int ins_nr = 0;
        int start_slot = 0;
 
@@ -4374,7 +4373,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
  */
 static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
                                   struct btrfs_root *root,
-                                  struct inode *inode,
+                                  struct btrfs_inode *inode,
                                   struct btrfs_path *path)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
@@ -4384,8 +4383,8 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
        u64 hole_size;
        struct extent_buffer *leaf;
        struct btrfs_root *log = root->log_root;
-       const u64 ino = btrfs_ino(BTRFS_I(inode));
-       const u64 i_size = i_size_read(inode);
+       const u64 ino = btrfs_ino(inode);
+       const u64 i_size = i_size_read(&inode->vfs_inode);
 
        if (!btrfs_fs_incompat(fs_info, NO_HOLES))
                return 0;
@@ -4495,7 +4494,7 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
 static int btrfs_check_ref_name_override(struct extent_buffer *eb,
                                         const int slot,
                                         const struct btrfs_key *key,
-                                        struct inode *inode,
+                                        struct btrfs_inode *inode,
                                         u64 *other_ino)
 {
        int ret;
@@ -4551,9 +4550,8 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
                }
 
                read_extent_buffer(eb, name, name_ptr, this_name_len);
-               di = btrfs_lookup_dir_item(NULL, BTRFS_I(inode)->root,
-                                          search_path, parent,
-                                          name, this_name_len, 0);
+               di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
+                               parent, name, this_name_len, 0);
                if (di && !IS_ERR(di)) {
                        struct btrfs_key di_key;
 
@@ -4699,7 +4697,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
                         * (zeroes), as if an expanding truncate happened,
                         * instead of getting a file of 4Kb only.
                         */
-                       err = logged_inode_size(log, inode, path,
+                       err = logged_inode_size(log, BTRFS_I(inode), path,
                                                &logged_isize);
                        if (err)
                                goto out_unlock;
@@ -4769,7 +4767,7 @@ again:
 
                        ret = btrfs_check_ref_name_override(path->nodes[0],
                                                            path->slots[0],
-                                                           &min_key, inode,
+                                                           &min_key, BTRFS_I(inode),
                                                            &other_ino);
                        if (ret < 0) {
                                err = ret;
@@ -4785,7 +4783,7 @@ again:
                                        ins_nr = 1;
                                        ins_start_slot = path->slots[0];
                                }
-                               ret = copy_items(trans, inode, dst_path, path,
+                               ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
                                                 &last_extent, ins_start_slot,
                                                 ins_nr, inode_only,
                                                 logged_isize);
@@ -4838,7 +4836,7 @@ again:
                if (min_key.type == BTRFS_XATTR_ITEM_KEY) {
                        if (ins_nr == 0)
                                goto next_slot;
-                       ret = copy_items(trans, inode, dst_path, path,
+                       ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
                                         &last_extent, ins_start_slot,
                                         ins_nr, inode_only, logged_isize);
                        if (ret < 0) {
@@ -4863,7 +4861,7 @@ again:
                        goto next_slot;
                }
 
-               ret = copy_items(trans, inode, dst_path, path, &last_extent,
+               ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
                                 ins_start_slot, ins_nr, inode_only,
                                 logged_isize);
                if (ret < 0) {
@@ -4887,7 +4885,7 @@ next_slot:
                        goto again;
                }
                if (ins_nr) {
-                       ret = copy_items(trans, inode, dst_path, path,
+                       ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
                                         &last_extent, ins_start_slot,
                                         ins_nr, inode_only, logged_isize);
                        if (ret < 0) {
@@ -4909,7 +4907,7 @@ next_key:
                }
        }
        if (ins_nr) {
-               ret = copy_items(trans, inode, dst_path, path, &last_extent,
+               ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
                                 ins_start_slot, ins_nr, inode_only,
                                 logged_isize);
                if (ret < 0) {
@@ -4922,13 +4920,13 @@ next_key:
 
        btrfs_release_path(path);
        btrfs_release_path(dst_path);
-       err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
+       err = btrfs_log_all_xattrs(trans, root, BTRFS_I(inode), path, dst_path);
        if (err)
                goto out_unlock;
        if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
                btrfs_release_path(path);
                btrfs_release_path(dst_path);
-               err = btrfs_log_trailing_hole(trans, root, inode, path);
+               err = btrfs_log_trailing_hole(trans, root, BTRFS_I(inode), path);
                if (err)
                        goto out_unlock;
        }
@@ -4941,7 +4939,7 @@ log_extents:
                        goto out_unlock;
        }
        if (fast_search) {
-               ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
+               ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
                                                &logged_list, ctx, start, end);
                if (ret) {
                        err = ret;
@@ -4980,8 +4978,8 @@ log_extents:
        }
 
        if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
-               ret = log_directory_changes(trans, root, inode, path, dst_path,
-                                           ctx);
+               ret = log_directory_changes(trans, root, BTRFS_I(inode), path,
+                               dst_path, ctx);
                if (ret) {
                        err = ret;
                        goto out_unlock;
@@ -5159,7 +5157,7 @@ struct btrfs_dir_list {
  */
 static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
                                struct btrfs_root *root,
-                               struct inode *start_inode,
+                               struct btrfs_inode *start_inode,
                                struct btrfs_log_ctx *ctx)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
@@ -5178,7 +5176,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
                btrfs_free_path(path);
                return -ENOMEM;
        }
-       dir_elem->ino = btrfs_ino(BTRFS_I(start_inode));
+       dir_elem->ino = btrfs_ino(start_inode);
        list_add_tail(&dir_elem->list, &dir_list);
 
        while (!list_empty(&dir_list)) {
@@ -5237,7 +5235,7 @@ process_leaf:
                                goto next_dir_inode;
                        }
 
-                       if (btrfs_inode_in_log(di_inode, trans->transid)) {
+                       if (btrfs_inode_in_log(BTRFS_I(di_inode), trans->transid)) {
                                iput(di_inode);
                                break;
                        }
@@ -5372,7 +5370,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
                                ret = 1;
                        if (!ret && ctx && ctx->log_new_dentries)
                                ret = log_new_dir_dentries(trans, root,
-                                                          dir_inode, ctx);
+                                                          BTRFS_I(dir_inode), ctx);
                        iput(dir_inode);
                        if (ret)
                                goto out;
@@ -5436,7 +5434,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
        if (ret)
                goto end_no_trans;
 
-       if (btrfs_inode_in_log(inode, trans->transid)) {
+       if (btrfs_inode_in_log(BTRFS_I(inode), trans->transid)) {
                ret = BTRFS_NO_LOG_SYNC;
                goto end_no_trans;
        }
@@ -5535,7 +5533,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
                old_parent = parent;
        }
        if (log_dentries)
-               ret = log_new_dir_dentries(trans, root, orig_inode, ctx);
+               ret = log_new_dir_dentries(trans, root, BTRFS_I(orig_inode), ctx);
        else
                ret = 0;
 end_trans:
@@ -5794,11 +5792,11 @@ record:
  * parent root and tree of tree roots trees, etc) are done.
  */
 void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
-                                  struct inode *dir)
+                                  struct btrfs_inode *dir)
 {
-       mutex_lock(&BTRFS_I(dir)->log_mutex);
-       BTRFS_I(dir)->last_unlink_trans = trans->transid;
-       mutex_unlock(&BTRFS_I(dir)->log_mutex);
+       mutex_lock(&dir->log_mutex);
+       dir->last_unlink_trans = trans->transid;
+       mutex_unlock(&dir->log_mutex);
 }
 
 /*
@@ -5809,30 +5807,28 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
  * full transaction commit is required.
  */
 int btrfs_log_new_name(struct btrfs_trans_handle *trans,
-                       struct inode *inode, struct inode *old_dir,
+                       struct btrfs_inode *inode, struct btrfs_inode *old_dir,
                        struct dentry *parent)
 {
-       struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-       struct btrfs_root * root = BTRFS_I(inode)->root;
+       struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+       struct btrfs_root * root = inode->root;
 
        /*
         * this will force the logging code to walk the dentry chain
         * up for the file
         */
-       if (S_ISREG(inode->i_mode))
-               BTRFS_I(inode)->last_unlink_trans = trans->transid;
+       if (S_ISREG(inode->vfs_inode.i_mode))
+               inode->last_unlink_trans = trans->transid;
 
        /*
         * if this inode hasn't been logged and directory we're renaming it
         * from hasn't been logged, we don't need to log it
         */
-       if (BTRFS_I(inode)->logged_trans <=
-           fs_info->last_trans_committed &&
-           (!old_dir || BTRFS_I(old_dir)->logged_trans <=
-                   fs_info->last_trans_committed))
+       if (inode->logged_trans <= fs_info->last_trans_committed &&
+           (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed))
                return 0;
 
-       return btrfs_log_inode_parent(trans, root, inode, parent, 0,
+       return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0,
                                      LLONG_MAX, 1, NULL);
 }