diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-11-04 23:13:25 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-11-11 22:13:44 -0500 |
commit | b02441999efcc6152b87cd58e7970bb7843f76cf (patch) | |
tree | 36f8e823f3ee84528f3f030323b472a72a915094 /fs/btrfs/extent-tree.c | |
parent | 9f3a074d108810139ad4af49a29d347a4cf41e9a (diff) | |
download | blackbird-op-linux-b02441999efcc6152b87cd58e7970bb7843f76cf.tar.gz blackbird-op-linux-b02441999efcc6152b87cd58e7970bb7843f76cf.zip |
Btrfs: don't wait for the completion of all the ordered extents
It is very likely that there are lots of ordered extents in the filesytem,
if we wait for the completion of all of them when we want to reclaim some
space for the metadata space reservation, we would be blocked for a long
time. The performance would drop down suddenly for a long time.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 83bffbea7d97..a21bbf83fdc2 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4018,7 +4018,7 @@ static void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root, */ btrfs_start_all_delalloc_inodes(root->fs_info, 0); if (!current->journal_info) - btrfs_wait_all_ordered_extents(root->fs_info); + btrfs_wait_ordered_roots(root->fs_info, -1); } } @@ -4050,11 +4050,12 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, long time_left; unsigned long nr_pages; int loops; + int items; enum btrfs_reserve_flush_enum flush; /* Calc the number of the pages we need flush for space reservation */ - to_reclaim = calc_reclaim_items_nr(root, to_reclaim); - to_reclaim *= EXTENT_SIZE_PER_ITEM; + items = calc_reclaim_items_nr(root, to_reclaim); + to_reclaim = items * EXTENT_SIZE_PER_ITEM; trans = (struct btrfs_trans_handle *)current->journal_info; block_rsv = &root->fs_info->delalloc_block_rsv; @@ -4066,7 +4067,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, if (trans) return; if (wait_ordered) - btrfs_wait_all_ordered_extents(root->fs_info); + btrfs_wait_ordered_roots(root->fs_info, items); return; } @@ -4105,7 +4106,7 @@ skip_async: loops++; if (wait_ordered && !trans) { - btrfs_wait_all_ordered_extents(root->fs_info); + btrfs_wait_ordered_roots(root->fs_info, items); } else { time_left = schedule_timeout_killable(1); if (time_left) |