diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2012-11-14 09:34:34 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-12 17:15:28 -0500 |
commit | b53d3f5db2b79637acadc06a330db6c2c60863f5 (patch) | |
tree | f5ad7a1612f413e1ae459eb88d20642972d6b02c /fs/btrfs/relocation.c | |
parent | 3ef5969cd8a42a78ccdbc53f7abb2e6136b2ec65 (diff) |
Btrfs: cleanup for btrfs_btree_balance_dirty
- 'nr' is no more used.
- btrfs_btree_balance_dirty() and __btrfs_btree_balance_dirty() can share
a bunch of code.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 270f24ffe1be..300e09ac3659 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2025,7 +2025,6 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, | |||
2025 | struct btrfs_root_item *root_item; | 2025 | struct btrfs_root_item *root_item; |
2026 | struct btrfs_path *path; | 2026 | struct btrfs_path *path; |
2027 | struct extent_buffer *leaf; | 2027 | struct extent_buffer *leaf; |
2028 | unsigned long nr; | ||
2029 | int level; | 2028 | int level; |
2030 | int max_level; | 2029 | int max_level; |
2031 | int replaced = 0; | 2030 | int replaced = 0; |
@@ -2126,10 +2125,9 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, | |||
2126 | path->slots[level]); | 2125 | path->slots[level]); |
2127 | root_item->drop_level = level; | 2126 | root_item->drop_level = level; |
2128 | 2127 | ||
2129 | nr = trans->blocks_used; | ||
2130 | btrfs_end_transaction_throttle(trans, root); | 2128 | btrfs_end_transaction_throttle(trans, root); |
2131 | 2129 | ||
2132 | btrfs_btree_balance_dirty(root, nr); | 2130 | btrfs_btree_balance_dirty(root); |
2133 | 2131 | ||
2134 | if (replaced && rc->stage == UPDATE_DATA_PTRS) | 2132 | if (replaced && rc->stage == UPDATE_DATA_PTRS) |
2135 | invalidate_extent_cache(root, &key, &next_key); | 2133 | invalidate_extent_cache(root, &key, &next_key); |
@@ -2156,10 +2154,9 @@ out: | |||
2156 | btrfs_update_reloc_root(trans, root); | 2154 | btrfs_update_reloc_root(trans, root); |
2157 | } | 2155 | } |
2158 | 2156 | ||
2159 | nr = trans->blocks_used; | ||
2160 | btrfs_end_transaction_throttle(trans, root); | 2157 | btrfs_end_transaction_throttle(trans, root); |
2161 | 2158 | ||
2162 | btrfs_btree_balance_dirty(root, nr); | 2159 | btrfs_btree_balance_dirty(root); |
2163 | 2160 | ||
2164 | if (replaced && rc->stage == UPDATE_DATA_PTRS) | 2161 | if (replaced && rc->stage == UPDATE_DATA_PTRS) |
2165 | invalidate_extent_cache(root, &key, &next_key); | 2162 | invalidate_extent_cache(root, &key, &next_key); |
@@ -3262,7 +3259,6 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, | |||
3262 | struct btrfs_path *path; | 3259 | struct btrfs_path *path; |
3263 | struct btrfs_root *root = fs_info->tree_root; | 3260 | struct btrfs_root *root = fs_info->tree_root; |
3264 | struct btrfs_trans_handle *trans; | 3261 | struct btrfs_trans_handle *trans; |
3265 | unsigned long nr; | ||
3266 | int ret = 0; | 3262 | int ret = 0; |
3267 | 3263 | ||
3268 | if (inode) | 3264 | if (inode) |
@@ -3296,9 +3292,8 @@ truncate: | |||
3296 | ret = btrfs_truncate_free_space_cache(root, trans, path, inode); | 3292 | ret = btrfs_truncate_free_space_cache(root, trans, path, inode); |
3297 | 3293 | ||
3298 | btrfs_free_path(path); | 3294 | btrfs_free_path(path); |
3299 | nr = trans->blocks_used; | ||
3300 | btrfs_end_transaction(trans, root); | 3295 | btrfs_end_transaction(trans, root); |
3301 | btrfs_btree_balance_dirty(root, nr); | 3296 | btrfs_btree_balance_dirty(root); |
3302 | out: | 3297 | out: |
3303 | iput(inode); | 3298 | iput(inode); |
3304 | return ret; | 3299 | return ret; |
@@ -3715,7 +3710,6 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3715 | struct btrfs_trans_handle *trans = NULL; | 3710 | struct btrfs_trans_handle *trans = NULL; |
3716 | struct btrfs_path *path; | 3711 | struct btrfs_path *path; |
3717 | struct btrfs_extent_item *ei; | 3712 | struct btrfs_extent_item *ei; |
3718 | unsigned long nr; | ||
3719 | u64 flags; | 3713 | u64 flags; |
3720 | u32 item_size; | 3714 | u32 item_size; |
3721 | int ret; | 3715 | int ret; |
@@ -3832,9 +3826,8 @@ restart: | |||
3832 | ret = btrfs_commit_transaction(trans, rc->extent_root); | 3826 | ret = btrfs_commit_transaction(trans, rc->extent_root); |
3833 | BUG_ON(ret); | 3827 | BUG_ON(ret); |
3834 | } else { | 3828 | } else { |
3835 | nr = trans->blocks_used; | ||
3836 | btrfs_end_transaction_throttle(trans, rc->extent_root); | 3829 | btrfs_end_transaction_throttle(trans, rc->extent_root); |
3837 | btrfs_btree_balance_dirty(rc->extent_root, nr); | 3830 | btrfs_btree_balance_dirty(rc->extent_root); |
3838 | } | 3831 | } |
3839 | trans = NULL; | 3832 | trans = NULL; |
3840 | 3833 | ||
@@ -3864,9 +3857,8 @@ restart: | |||
3864 | GFP_NOFS); | 3857 | GFP_NOFS); |
3865 | 3858 | ||
3866 | if (trans) { | 3859 | if (trans) { |
3867 | nr = trans->blocks_used; | ||
3868 | btrfs_end_transaction_throttle(trans, rc->extent_root); | 3860 | btrfs_end_transaction_throttle(trans, rc->extent_root); |
3869 | btrfs_btree_balance_dirty(rc->extent_root, nr); | 3861 | btrfs_btree_balance_dirty(rc->extent_root); |
3870 | } | 3862 | } |
3871 | 3863 | ||
3872 | if (!err) { | 3864 | if (!err) { |
@@ -3945,7 +3937,6 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info, | |||
3945 | struct btrfs_trans_handle *trans; | 3937 | struct btrfs_trans_handle *trans; |
3946 | struct btrfs_root *root; | 3938 | struct btrfs_root *root; |
3947 | struct btrfs_key key; | 3939 | struct btrfs_key key; |
3948 | unsigned long nr; | ||
3949 | u64 objectid = BTRFS_FIRST_FREE_OBJECTID; | 3940 | u64 objectid = BTRFS_FIRST_FREE_OBJECTID; |
3950 | int err = 0; | 3941 | int err = 0; |
3951 | 3942 | ||
@@ -3973,9 +3964,8 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info, | |||
3973 | 3964 | ||
3974 | err = btrfs_orphan_add(trans, inode); | 3965 | err = btrfs_orphan_add(trans, inode); |
3975 | out: | 3966 | out: |
3976 | nr = trans->blocks_used; | ||
3977 | btrfs_end_transaction(trans, root); | 3967 | btrfs_end_transaction(trans, root); |
3978 | btrfs_btree_balance_dirty(root, nr); | 3968 | btrfs_btree_balance_dirty(root); |
3979 | if (err) { | 3969 | if (err) { |
3980 | if (inode) | 3970 | if (inode) |
3981 | iput(inode); | 3971 | iput(inode); |