Merge branch 'x86-seccomp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / relocation.c
index b55ea3735a5ff2881f2f5f9c0eaa81c1e341f62d..74257d6436adda1b772d8658be41202093ef577a 100644 (file)
@@ -1846,8 +1846,7 @@ again:
                                break;
                        }
 
-                       eb = read_tree_block(dest, old_bytenr, blocksize,
-                                            old_ptr_gen);
+                       eb = read_tree_block(dest, old_bytenr, old_ptr_gen);
                        if (!eb || !extent_buffer_uptodate(eb)) {
                                ret = (!eb) ? -ENOMEM : -EIO;
                                free_extent_buffer(eb);
@@ -1977,7 +1976,6 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
        u64 bytenr;
        u64 ptr_gen = 0;
        u64 last_snapshot;
-       u32 blocksize;
        u32 nritems;
 
        last_snapshot = btrfs_root_last_snapshot(&root->root_item);
@@ -2003,8 +2001,7 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
                }
 
                bytenr = btrfs_node_blockptr(eb, path->slots[i]);
-               blocksize = root->nodesize;
-               eb = read_tree_block(root, bytenr, blocksize, ptr_gen);
+               eb = read_tree_block(root, bytenr, ptr_gen);
                if (!eb || !extent_buffer_uptodate(eb)) {
                        free_extent_buffer(eb);
                        return -EIO;
@@ -2349,7 +2346,7 @@ void free_reloc_roots(struct list_head *list)
 }
 
 static noinline_for_stack
-int merge_reloc_roots(struct reloc_control *rc)
+void merge_reloc_roots(struct reloc_control *rc)
 {
        struct btrfs_root *root;
        struct btrfs_root *reloc_root;
@@ -2430,7 +2427,6 @@ out:
        }
 
        BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root));
-       return ret;
 }
 
 static void free_block_list(struct rb_root *blocks)
@@ -2713,7 +2709,7 @@ static int do_relocation(struct btrfs_trans_handle *trans,
 
                blocksize = root->nodesize;
                generation = btrfs_node_ptr_generation(upper->eb, slot);
-               eb = read_tree_block(root, bytenr, blocksize, generation);
+               eb = read_tree_block(root, bytenr, generation);
                if (!eb || !extent_buffer_uptodate(eb)) {
                        free_extent_buffer(eb);
                        err = -EIO;
@@ -2875,7 +2871,7 @@ static int get_tree_block_key(struct reloc_control *rc,
 
        BUG_ON(block->key_ready);
        eb = read_tree_block(rc->extent_root, block->bytenr,
-                            block->key.objectid, block->key.offset);
+                            block->key.offset);
        if (!eb || !extent_buffer_uptodate(eb)) {
                free_extent_buffer(eb);
                return -EIO;
@@ -2890,20 +2886,6 @@ static int get_tree_block_key(struct reloc_control *rc,
        return 0;
 }
 
-static int reada_tree_block(struct reloc_control *rc,
-                           struct tree_block *block)
-{
-       BUG_ON(block->key_ready);
-       if (block->key.type == BTRFS_METADATA_ITEM_KEY)
-               readahead_tree_block(rc->extent_root, block->bytenr,
-                                    block->key.objectid,
-                                    rc->extent_root->nodesize);
-       else
-               readahead_tree_block(rc->extent_root, block->bytenr,
-                                    block->key.objectid, block->key.offset);
-       return 0;
-}
-
 /*
  * helper function to relocate a tree block
  */
@@ -2983,7 +2965,8 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
        while (rb_node) {
                block = rb_entry(rb_node, struct tree_block, rb_node);
                if (!block->key_ready)
-                       reada_tree_block(rc, block);
+                       readahead_tree_block(rc->extent_root, block->bytenr,
+                                       block->key.objectid);
                rb_node = rb_next(rb_node);
        }