diff options
author | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-05-16 11:04:52 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-05-26 06:17:53 -0400 |
commit | 5581a51a59a1f5f51ac3d4bacafb738d35e0350b (patch) | |
tree | d7e291e139d08f2be7870c9da602658df8f51ce8 /fs/btrfs/ctree.c | |
parent | 976b1908d97bd8cbd024ba7aafaa3fb637ea8e13 (diff) |
Btrfs: don't set for_cow parameter for tree block functions
Three callers of btrfs_free_tree_block or btrfs_alloc_tree_block passed
parameter for_cow = 1. In fact, these two functions should never mark
their tree modification operations as for_cow, because they can change
the number of blocks referenced by a tree.
Hence, we remove the extra for_cow parameter from these functions and
make them pass a zero down.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 4106264fbc65..56485b3b7c31 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -255,7 +255,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, | |||
255 | 255 | ||
256 | cow = btrfs_alloc_free_block(trans, root, buf->len, 0, | 256 | cow = btrfs_alloc_free_block(trans, root, buf->len, 0, |
257 | new_root_objectid, &disk_key, level, | 257 | new_root_objectid, &disk_key, level, |
258 | buf->start, 0, 1); | 258 | buf->start, 0); |
259 | if (IS_ERR(cow)) | 259 | if (IS_ERR(cow)) |
260 | return PTR_ERR(cow); | 260 | return PTR_ERR(cow); |
261 | 261 | ||
@@ -467,7 +467,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
467 | 467 | ||
468 | cow = btrfs_alloc_free_block(trans, root, buf->len, parent_start, | 468 | cow = btrfs_alloc_free_block(trans, root, buf->len, parent_start, |
469 | root->root_key.objectid, &disk_key, | 469 | root->root_key.objectid, &disk_key, |
470 | level, search_start, empty_size, 1); | 470 | level, search_start, empty_size); |
471 | if (IS_ERR(cow)) | 471 | if (IS_ERR(cow)) |
472 | return PTR_ERR(cow); | 472 | return PTR_ERR(cow); |
473 | 473 | ||
@@ -509,7 +509,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
509 | rcu_assign_pointer(root->node, cow); | 509 | rcu_assign_pointer(root->node, cow); |
510 | 510 | ||
511 | btrfs_free_tree_block(trans, root, buf, parent_start, | 511 | btrfs_free_tree_block(trans, root, buf, parent_start, |
512 | last_ref, 1); | 512 | last_ref); |
513 | free_extent_buffer(buf); | 513 | free_extent_buffer(buf); |
514 | add_root_to_dirty_list(root); | 514 | add_root_to_dirty_list(root); |
515 | } else { | 515 | } else { |
@@ -525,7 +525,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
525 | trans->transid); | 525 | trans->transid); |
526 | btrfs_mark_buffer_dirty(parent); | 526 | btrfs_mark_buffer_dirty(parent); |
527 | btrfs_free_tree_block(trans, root, buf, parent_start, | 527 | btrfs_free_tree_block(trans, root, buf, parent_start, |
528 | last_ref, 1); | 528 | last_ref); |
529 | } | 529 | } |
530 | if (unlock_orig) | 530 | if (unlock_orig) |
531 | btrfs_tree_unlock(buf); | 531 | btrfs_tree_unlock(buf); |
@@ -987,7 +987,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
987 | free_extent_buffer(mid); | 987 | free_extent_buffer(mid); |
988 | 988 | ||
989 | root_sub_used(root, mid->len); | 989 | root_sub_used(root, mid->len); |
990 | btrfs_free_tree_block(trans, root, mid, 0, 1, 0); | 990 | btrfs_free_tree_block(trans, root, mid, 0, 1); |
991 | /* once for the root ptr */ | 991 | /* once for the root ptr */ |
992 | free_extent_buffer_stale(mid); | 992 | free_extent_buffer_stale(mid); |
993 | return 0; | 993 | return 0; |
@@ -1042,7 +1042,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
1042 | btrfs_tree_unlock(right); | 1042 | btrfs_tree_unlock(right); |
1043 | del_ptr(trans, root, path, level + 1, pslot + 1); | 1043 | del_ptr(trans, root, path, level + 1, pslot + 1); |
1044 | root_sub_used(root, right->len); | 1044 | root_sub_used(root, right->len); |
1045 | btrfs_free_tree_block(trans, root, right, 0, 1, 0); | 1045 | btrfs_free_tree_block(trans, root, right, 0, 1); |
1046 | free_extent_buffer_stale(right); | 1046 | free_extent_buffer_stale(right); |
1047 | right = NULL; | 1047 | right = NULL; |
1048 | } else { | 1048 | } else { |
@@ -1084,7 +1084,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
1084 | btrfs_tree_unlock(mid); | 1084 | btrfs_tree_unlock(mid); |
1085 | del_ptr(trans, root, path, level + 1, pslot); | 1085 | del_ptr(trans, root, path, level + 1, pslot); |
1086 | root_sub_used(root, mid->len); | 1086 | root_sub_used(root, mid->len); |
1087 | btrfs_free_tree_block(trans, root, mid, 0, 1, 0); | 1087 | btrfs_free_tree_block(trans, root, mid, 0, 1); |
1088 | free_extent_buffer_stale(mid); | 1088 | free_extent_buffer_stale(mid); |
1089 | mid = NULL; | 1089 | mid = NULL; |
1090 | } else { | 1090 | } else { |
@@ -2129,7 +2129,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans, | |||
2129 | 2129 | ||
2130 | c = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 2130 | c = btrfs_alloc_free_block(trans, root, root->nodesize, 0, |
2131 | root->root_key.objectid, &lower_key, | 2131 | root->root_key.objectid, &lower_key, |
2132 | level, root->node->start, 0, 0); | 2132 | level, root->node->start, 0); |
2133 | if (IS_ERR(c)) | 2133 | if (IS_ERR(c)) |
2134 | return PTR_ERR(c); | 2134 | return PTR_ERR(c); |
2135 | 2135 | ||
@@ -2252,7 +2252,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans, | |||
2252 | 2252 | ||
2253 | split = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 2253 | split = btrfs_alloc_free_block(trans, root, root->nodesize, 0, |
2254 | root->root_key.objectid, | 2254 | root->root_key.objectid, |
2255 | &disk_key, level, c->start, 0, 0); | 2255 | &disk_key, level, c->start, 0); |
2256 | if (IS_ERR(split)) | 2256 | if (IS_ERR(split)) |
2257 | return PTR_ERR(split); | 2257 | return PTR_ERR(split); |
2258 | 2258 | ||
@@ -3004,7 +3004,7 @@ again: | |||
3004 | 3004 | ||
3005 | right = btrfs_alloc_free_block(trans, root, root->leafsize, 0, | 3005 | right = btrfs_alloc_free_block(trans, root, root->leafsize, 0, |
3006 | root->root_key.objectid, | 3006 | root->root_key.objectid, |
3007 | &disk_key, 0, l->start, 0, 0); | 3007 | &disk_key, 0, l->start, 0); |
3008 | if (IS_ERR(right)) | 3008 | if (IS_ERR(right)) |
3009 | return PTR_ERR(right); | 3009 | return PTR_ERR(right); |
3010 | 3010 | ||
@@ -3804,7 +3804,7 @@ static noinline void btrfs_del_leaf(struct btrfs_trans_handle *trans, | |||
3804 | root_sub_used(root, leaf->len); | 3804 | root_sub_used(root, leaf->len); |
3805 | 3805 | ||
3806 | extent_buffer_get(leaf); | 3806 | extent_buffer_get(leaf); |
3807 | btrfs_free_tree_block(trans, root, leaf, 0, 1, 0); | 3807 | btrfs_free_tree_block(trans, root, leaf, 0, 1); |
3808 | free_extent_buffer_stale(leaf); | 3808 | free_extent_buffer_stale(leaf); |
3809 | } | 3809 | } |
3810 | /* | 3810 | /* |