aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.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/disk-io.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/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 07a2162cdd6..ff5d259ac27 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3411,7 +3411,8 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
3411 } 3411 }
3412} 3412}
3413 3413
3414void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) 3414static void __btrfs_btree_balance_dirty(struct btrfs_root *root,
3415 int flush_delayed)
3415{ 3416{
3416 /* 3417 /*
3417 * looks as though older kernels can get into trouble with 3418 * looks as though older kernels can get into trouble with
@@ -3423,7 +3424,8 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
3423 if (current->flags & PF_MEMALLOC) 3424 if (current->flags & PF_MEMALLOC)
3424 return; 3425 return;
3425 3426
3426 btrfs_balance_delayed_items(root); 3427 if (flush_delayed)
3428 btrfs_balance_delayed_items(root);
3427 3429
3428 num_dirty = root->fs_info->dirty_metadata_bytes; 3430 num_dirty = root->fs_info->dirty_metadata_bytes;
3429 3431
@@ -3434,25 +3436,14 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
3434 return; 3436 return;
3435} 3437}
3436 3438
3437void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) 3439void btrfs_btree_balance_dirty(struct btrfs_root *root)
3438{ 3440{
3439 /* 3441 __btrfs_btree_balance_dirty(root, 1);
3440 * looks as though older kernels can get into trouble with 3442}
3441 * this code, they end up stuck in balance_dirty_pages forever
3442 */
3443 u64 num_dirty;
3444 unsigned long thresh = 32 * 1024 * 1024;
3445
3446 if (current->flags & PF_MEMALLOC)
3447 return;
3448
3449 num_dirty = root->fs_info->dirty_metadata_bytes;
3450 3443
3451 if (num_dirty > thresh) { 3444void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root)
3452 balance_dirty_pages_ratelimited_nr( 3445{
3453 root->fs_info->btree_inode->i_mapping, 1); 3446 __btrfs_btree_balance_dirty(root, 0);
3454 }
3455 return;
3456} 3447}
3457 3448
3458int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid) 3449int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)