aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2012-11-14 09:34:34 -0500
committerJosef Bacik <jbacik@fusionio.com>2012-12-12 17:15:28 -0500
commitb53d3f5db2b79637acadc06a330db6c2c60863f5 (patch)
treef5ad7a1612f413e1ae459eb88d20642972d6b02c /fs/btrfs/file.c
parent3ef5969cd8a42a78ccdbc53f7abb2e6136b2ec65 (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/file.c')
-rw-r--r--fs/btrfs/file.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 883cf826cf25..bd7f1b01e051 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1349,7 +1349,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
1349 balance_dirty_pages_ratelimited_nr(inode->i_mapping, 1349 balance_dirty_pages_ratelimited_nr(inode->i_mapping,
1350 dirty_pages); 1350 dirty_pages);
1351 if (dirty_pages < (root->leafsize >> PAGE_CACHE_SHIFT) + 1) 1351 if (dirty_pages < (root->leafsize >> PAGE_CACHE_SHIFT) + 1)
1352 btrfs_btree_balance_dirty(root, 1); 1352 btrfs_btree_balance_dirty(root);
1353 1353
1354 pos += copied; 1354 pos += copied;
1355 num_written += copied; 1355 num_written += copied;
@@ -1803,7 +1803,6 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
1803 u64 cur_offset = lockstart; 1803 u64 cur_offset = lockstart;
1804 u64 min_size = btrfs_calc_trunc_metadata_size(root, 1); 1804 u64 min_size = btrfs_calc_trunc_metadata_size(root, 1);
1805 u64 drop_end; 1805 u64 drop_end;
1806 unsigned long nr;
1807 int ret = 0; 1806 int ret = 0;
1808 int err = 0; 1807 int err = 0;
1809 bool same_page = (offset >> PAGE_CACHE_SHIFT) == 1808 bool same_page = (offset >> PAGE_CACHE_SHIFT) ==
@@ -1931,9 +1930,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
1931 break; 1930 break;
1932 } 1931 }
1933 1932
1934 nr = trans->blocks_used;
1935 btrfs_end_transaction(trans, root); 1933 btrfs_end_transaction(trans, root);
1936 btrfs_btree_balance_dirty(root, nr); 1934 btrfs_btree_balance_dirty(root);
1937 1935
1938 trans = btrfs_start_transaction(root, 3); 1936 trans = btrfs_start_transaction(root, 3);
1939 if (IS_ERR(trans)) { 1937 if (IS_ERR(trans)) {
@@ -1969,9 +1967,8 @@ out_trans:
1969 1967
1970 trans->block_rsv = &root->fs_info->trans_block_rsv; 1968 trans->block_rsv = &root->fs_info->trans_block_rsv;
1971 ret = btrfs_update_inode(trans, root, inode); 1969 ret = btrfs_update_inode(trans, root, inode);
1972 nr = trans->blocks_used;
1973 btrfs_end_transaction(trans, root); 1970 btrfs_end_transaction(trans, root);
1974 btrfs_btree_balance_dirty(root, nr); 1971 btrfs_btree_balance_dirty(root);
1975out_free: 1972out_free:
1976 btrfs_free_path(path); 1973 btrfs_free_path(path);
1977 btrfs_free_block_rsv(root, rsv); 1974 btrfs_free_block_rsv(root, rsv);