btrfs: get fs_info from trans in insert_ptr
authorDavid Sterba <dsterba@suse.com>
Wed, 20 Mar 2019 13:32:45 +0000 (14:32 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:42 +0000 (19:02 +0200)
We can read fs_info from the transaction and can drop it from the
parameters.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c

index e76e69f..f779104 100644 (file)
@@ -3407,7 +3407,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
  * blocknr is the block the key points to.
  */
 static void insert_ptr(struct btrfs_trans_handle *trans,
-                      struct btrfs_fs_info *fs_info, struct btrfs_path *path,
+                      struct btrfs_path *path,
                       struct btrfs_disk_key *key, u64 bytenr,
                       int slot, int level)
 {
@@ -3420,7 +3420,7 @@ static void insert_ptr(struct btrfs_trans_handle *trans,
        lower = path->nodes[level];
        nritems = btrfs_header_nritems(lower);
        BUG_ON(slot > nritems);
-       BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(fs_info));
+       BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(trans->fs_info));
        if (slot != nritems) {
                if (level) {
                        ret = tree_mod_log_insert_move(lower, slot + 1, slot,
@@ -3520,7 +3520,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
        btrfs_mark_buffer_dirty(c);
        btrfs_mark_buffer_dirty(split);
 
-       insert_ptr(trans, fs_info, path, &disk_key, split->start,
+       insert_ptr(trans, path, &disk_key, split->start,
                   path->slots[level + 1] + 1, level + 1);
 
        if (path->slots[level] >= mid) {
@@ -4084,8 +4084,7 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans,
 
        btrfs_set_header_nritems(l, mid);
        btrfs_item_key(right, &disk_key, 0);
-       insert_ptr(trans, fs_info, path, &disk_key, right->start,
-                  path->slots[1] + 1, 1);
+       insert_ptr(trans, path, &disk_key, right->start, path->slots[1] + 1, 1);
 
        btrfs_mark_buffer_dirty(right);
        btrfs_mark_buffer_dirty(l);
@@ -4291,7 +4290,7 @@ again:
        if (split == 0) {
                if (mid <= slot) {
                        btrfs_set_header_nritems(right, 0);
-                       insert_ptr(trans, fs_info, path, &disk_key,
+                       insert_ptr(trans, path, &disk_key,
                                   right->start, path->slots[1] + 1, 1);
                        btrfs_tree_unlock(path->nodes[0]);
                        free_extent_buffer(path->nodes[0]);
@@ -4300,7 +4299,7 @@ again:
                        path->slots[1] += 1;
                } else {
                        btrfs_set_header_nritems(right, 0);
-                       insert_ptr(trans, fs_info, path, &disk_key,
+                       insert_ptr(trans, path, &disk_key,
                                   right->start, path->slots[1], 1);
                        btrfs_tree_unlock(path->nodes[0]);
                        free_extent_buffer(path->nodes[0]);