Commit 699122f5 authored by Chris Mason's avatar Chris Mason

Btrfs: Don't wait on tree block writeback before freeing them anymore

This isn't required anymore because we don't reallocate blocks that
have already been written in this transaction.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent e015640f
...@@ -751,7 +751,6 @@ static int balance_level(struct btrfs_trans_handle *trans, ...@@ -751,7 +751,6 @@ static int balance_level(struct btrfs_trans_handle *trans,
add_root_to_dirty_list(root); add_root_to_dirty_list(root);
path->nodes[level] = NULL; path->nodes[level] = NULL;
clean_tree_block(trans, root, mid); clean_tree_block(trans, root, mid);
wait_on_tree_block_writeback(root, mid);
/* once for the path */ /* once for the path */
free_extent_buffer(mid); free_extent_buffer(mid);
ret = btrfs_free_extent(trans, root, mid->start, mid->len, ret = btrfs_free_extent(trans, root, mid->start, mid->len,
...@@ -810,7 +809,6 @@ static int balance_level(struct btrfs_trans_handle *trans, ...@@ -810,7 +809,6 @@ static int balance_level(struct btrfs_trans_handle *trans,
u32 blocksize = right->len; u32 blocksize = right->len;
clean_tree_block(trans, root, right); clean_tree_block(trans, root, right);
wait_on_tree_block_writeback(root, right);
free_extent_buffer(right); free_extent_buffer(right);
right = NULL; right = NULL;
wret = del_ptr(trans, root, path, level + 1, pslot + wret = del_ptr(trans, root, path, level + 1, pslot +
...@@ -854,7 +852,6 @@ static int balance_level(struct btrfs_trans_handle *trans, ...@@ -854,7 +852,6 @@ static int balance_level(struct btrfs_trans_handle *trans,
u64 bytenr = mid->start; u64 bytenr = mid->start;
u32 blocksize = mid->len; u32 blocksize = mid->len;
clean_tree_block(trans, root, mid); clean_tree_block(trans, root, mid);
wait_on_tree_block_writeback(root, mid);
free_extent_buffer(mid); free_extent_buffer(mid);
mid = NULL; mid = NULL;
wret = del_ptr(trans, root, path, level + 1, pslot); wret = del_ptr(trans, root, path, level + 1, pslot);
...@@ -2638,7 +2635,6 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -2638,7 +2635,6 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
} else { } else {
u64 root_gen = btrfs_header_generation(path->nodes[1]); u64 root_gen = btrfs_header_generation(path->nodes[1]);
clean_tree_block(trans, root, leaf); clean_tree_block(trans, root, leaf);
wait_on_tree_block_writeback(root, leaf);
wret = del_ptr(trans, root, path, 1, path->slots[1]); wret = del_ptr(trans, root, path, 1, path->slots[1]);
if (wret) if (wret)
ret = wret; ret = wret;
...@@ -2690,7 +2686,6 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -2690,7 +2686,6 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
path->nodes[1]); path->nodes[1]);
clean_tree_block(trans, root, leaf); clean_tree_block(trans, root, leaf);
wait_on_tree_block_writeback(root, leaf);
wret = del_ptr(trans, root, path, 1, slot); wret = del_ptr(trans, root, path, 1, slot);
if (wret) if (wret)
......
...@@ -1887,7 +1887,6 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans, ...@@ -1887,7 +1887,6 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
} }
btrfs_set_header_generation(buf, trans->transid); btrfs_set_header_generation(buf, trans->transid);
clean_tree_block(trans, root, buf); clean_tree_block(trans, root, buf);
wait_on_tree_block_writeback(root, buf);
btrfs_set_buffer_uptodate(buf); btrfs_set_buffer_uptodate(buf);
if (PageDirty(buf->first_page)) { if (PageDirty(buf->first_page)) {
......
...@@ -383,9 +383,11 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end) ...@@ -383,9 +383,11 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
struct btrfs_csum_item *item; struct btrfs_csum_item *item;
struct btrfs_path *path = NULL; struct btrfs_path *path = NULL;
u32 csum; u32 csum;
if (btrfs_test_opt(root, NODATASUM) || if (btrfs_test_opt(root, NODATASUM) ||
btrfs_test_flag(inode, NODATASUM)) btrfs_test_flag(inode, NODATASUM))
return 0; return 0;
mutex_lock(&root->fs_info->fs_mutex); mutex_lock(&root->fs_info->fs_mutex);
path = btrfs_alloc_path(); path = btrfs_alloc_path();
item = btrfs_lookup_csum(NULL, root, path, inode->i_ino, start, 0); item = btrfs_lookup_csum(NULL, root, path, inode->i_ino, start, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment