btrfs: Remove fs_info from insert_extent_data_ref
[sfrench/cifs-2.6.git] / fs / btrfs / extent-tree.c
index 3d9fe58c0080db89f4933f162f8bf7f8d6df1c85..bb89522c0de666e7f89e8c478b4f2de992273352 100644 (file)
@@ -1304,13 +1304,12 @@ fail:
 }
 
 static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans,
-                                          struct btrfs_fs_info *fs_info,
                                           struct btrfs_path *path,
                                           u64 bytenr, u64 parent,
                                           u64 root_objectid, u64 owner,
                                           u64 offset, int refs_to_add)
 {
-       struct btrfs_root *root = fs_info->extent_root;
+       struct btrfs_root *root = trans->fs_info->extent_root;
        struct btrfs_key key;
        struct extent_buffer *leaf;
        u32 size;
@@ -1523,7 +1522,6 @@ static noinline int lookup_tree_block_ref(struct btrfs_trans_handle *trans,
 }
 
 static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans,
-                                         struct btrfs_fs_info *fs_info,
                                          struct btrfs_path *path,
                                          u64 bytenr, u64 parent,
                                          u64 root_objectid)
@@ -1540,7 +1538,7 @@ static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans,
                key.offset = root_objectid;
        }
 
-       ret = btrfs_insert_empty_item(trans, fs_info->extent_root,
+       ret = btrfs_insert_empty_item(trans, trans->fs_info->extent_root,
                                      path, &key, 0);
        btrfs_release_path(path);
        return ret;
@@ -1635,8 +1633,8 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
                extra_size = -1;
 
        /*
-        * Owner is our parent level, so we can just add one to get the level
-        * for the block we are interested in.
+        * Owner is our level, so we can just add one to get the level for the
+        * block we are interested in.
         */
        if (skinny_metadata && owner < BTRFS_FIRST_FREE_OBJECTID) {
                key.type = BTRFS_METADATA_ITEM_KEY;
@@ -2000,12 +1998,12 @@ static int insert_extent_backref(struct btrfs_trans_handle *trans,
        int ret;
        if (owner < BTRFS_FIRST_FREE_OBJECTID) {
                BUG_ON(refs_to_add != 1);
-               ret = insert_tree_block_ref(trans, fs_info, path, bytenr,
-                                           parent, root_objectid);
+               ret = insert_tree_block_ref(trans, path, bytenr, parent,
+                                           root_objectid);
        } else {
-               ret = insert_extent_data_ref(trans, fs_info, path, bytenr,
-                                            parent, root_objectid,
-                                            owner, offset, refs_to_add);
+               ret = insert_extent_data_ref(trans, path, bytenr, parent,
+                                            root_objectid, owner, offset,
+                                            refs_to_add);
        }
        return ret;
 }
@@ -2207,6 +2205,40 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
        return ret;
 }
 
+/*
+ * __btrfs_inc_extent_ref - insert backreference for a given extent
+ *
+ * @trans:         Handle of transaction
+ *
+ * @node:          The delayed ref node used to get the bytenr/length for
+ *                 extent whose references are incremented.
+ *
+ * @parent:        If this is a shared extent (BTRFS_SHARED_DATA_REF_KEY/
+ *                 BTRFS_SHARED_BLOCK_REF_KEY) then it holds the logical
+ *                 bytenr of the parent block. Since new extents are always
+ *                 created with indirect references, this will only be the case
+ *                 when relocating a shared extent. In that case, root_objectid
+ *                 will be BTRFS_TREE_RELOC_OBJECTID. Otheriwse, parent must
+ *                 be 0
+ *
+ * @root_objectid:  The id of the root where this modification has originated,
+ *                 this can be either one of the well-known metadata trees or
+ *                 the subvolume id which references this extent.
+ *
+ * @owner:         For data extents it is the inode number of the owning file.
+ *                 For metadata extents this parameter holds the level in the
+ *                 tree of the extent.
+ *
+ * @offset:        For metadata extents the offset is ignored and is currently
+ *                 always passed as 0. For data extents it is the fileoffset
+ *                 this extent belongs to.
+ *
+ * @refs_to_add     Number of references to add
+ *
+ * @extent_op       Pointer to a structure, holding information necessary when
+ *                  updating a tree block's flags
+ *
+ */
 static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
                                  struct btrfs_fs_info *fs_info,
                                  struct btrfs_delayed_ref_node *node,
@@ -6279,7 +6311,7 @@ static int update_block_group(struct btrfs_trans_handle *trans,
                if (list_empty(&cache->dirty_list)) {
                        list_add_tail(&cache->dirty_list,
                                      &trans->transaction->dirty_bgs);
-                               trans->transaction->num_dirty_bgs++;
+                       trans->transaction->num_dirty_bgs++;
                        btrfs_get_block_group(cache);
                }
                spin_unlock(&trans->transaction->dirty_bgs_lock);
@@ -7534,7 +7566,7 @@ search:
                 * for the proper type.
                 */
                if (!block_group_bits(block_group, flags)) {
-                   u64 extra = BTRFS_BLOCK_GROUP_DUP |
+                       u64 extra = BTRFS_BLOCK_GROUP_DUP |
                                BTRFS_BLOCK_GROUP_RAID1 |
                                BTRFS_BLOCK_GROUP_RAID5 |
                                BTRFS_BLOCK_GROUP_RAID6 |