btrfs: Make clone_update_extent_map take btrfs_inode
authorNikolay Borisov <nborisov@suse.com>
Mon, 20 Feb 2017 11:51:04 +0000 (13:51 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 28 Feb 2017 10:30:11 +0000 (11:30 +0100)
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index bb4e6ec26b7f1d5d2bba43736a7fd5640606a40e..12ae210f87194f25d2c0634ebf0404c51b905747 100644 (file)
@@ -3311,20 +3311,19 @@ out:
        return ret;
 }
 
-static void clone_update_extent_map(struct inode *inode,
+static void clone_update_extent_map(struct btrfs_inode *inode,
                                    const struct btrfs_trans_handle *trans,
                                    const struct btrfs_path *path,
                                    const u64 hole_offset,
                                    const u64 hole_len)
 {
-       struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
+       struct extent_map_tree *em_tree = &inode->extent_tree;
        struct extent_map *em;
        int ret;
 
        em = alloc_extent_map();
        if (!em) {
-               set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
-                       &BTRFS_I(inode)->runtime_flags);
+               set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags);
                return;
        }
 
@@ -3333,13 +3332,12 @@ static void clone_update_extent_map(struct inode *inode,
 
                fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
                                    struct btrfs_file_extent_item);
-               btrfs_extent_item_to_extent_map(BTRFS_I(inode), path, fi,
-                               false, em);
+               btrfs_extent_item_to_extent_map(inode, path, fi, false, em);
                em->generation = -1;
                if (btrfs_file_extent_type(path->nodes[0], fi) ==
                    BTRFS_FILE_EXTENT_INLINE)
                        set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
-                               &BTRFS_I(inode)->runtime_flags);
+                                       &inode->runtime_flags);
        } else {
                em->start = hole_offset;
                em->len = hole_len;
@@ -3360,13 +3358,12 @@ static void clone_update_extent_map(struct inode *inode,
                        free_extent_map(em);
                        break;
                }
-               btrfs_drop_extent_cache(BTRFS_I(inode), em->start,
+               btrfs_drop_extent_cache(inode, em->start,
                                        em->start + em->len - 1, 0);
        }
 
        if (ret)
-               set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
-                       &BTRFS_I(inode)->runtime_flags);
+               set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags);
 }
 
 /*
@@ -3792,11 +3789,12 @@ process_slot:
 
                        /* If we have an implicit hole (NO_HOLES feature). */
                        if (drop_start < new_key.offset)
-                               clone_update_extent_map(inode, trans,
+                               clone_update_extent_map(BTRFS_I(inode), trans,
                                                NULL, drop_start,
                                                new_key.offset - drop_start);
 
-                       clone_update_extent_map(inode, trans, path, 0, 0);
+                       clone_update_extent_map(BTRFS_I(inode), trans,
+                                       path, 0, 0);
 
                        btrfs_mark_buffer_dirty(leaf);
                        btrfs_release_path(path);
@@ -3846,8 +3844,9 @@ process_slot:
                        btrfs_end_transaction(trans);
                        goto out;
                }
-               clone_update_extent_map(inode, trans, NULL, last_dest_end,
-                                       destoff + len - last_dest_end);
+               clone_update_extent_map(BTRFS_I(inode), trans, NULL,
+                               last_dest_end,
+                               destoff + len - last_dest_end);
                ret = clone_finish_inode_update(trans, inode, destoff + len,
                                                destoff, olen, no_time_update);
        }