aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-11-04 10:13:25 -0500
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:13:44 -0500
commitb02441999efcc6152b87cd58e7970bb7843f76cf (patch)
tree36f8e823f3ee84528f3f030323b472a72a915094 /fs/btrfs/extent-tree.c
parent9f3a074d108810139ad4af49a29d347a4cf41e9a (diff)
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.c11
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,
4018 */ 4018 */
4019 btrfs_start_all_delalloc_inodes(root->fs_info, 0); 4019 btrfs_start_all_delalloc_inodes(root->fs_info, 0);
4020 if (!current->journal_info) 4020 if (!current->journal_info)
4021 btrfs_wait_all_ordered_extents(root->fs_info); 4021 btrfs_wait_ordered_roots(root->fs_info, -1);
4022 } 4022 }
4023} 4023}
4024 4024
@@ -4050,11 +4050,12 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
4050 long time_left; 4050 long time_left;
4051 unsigned long nr_pages; 4051 unsigned long nr_pages;
4052 int loops; 4052 int loops;
4053 int items;
4053 enum btrfs_reserve_flush_enum flush; 4054 enum btrfs_reserve_flush_enum flush;
4054 4055
4055 /* Calc the number of the pages we need flush for space reservation */ 4056 /* Calc the number of the pages we need flush for space reservation */
4056 to_reclaim = calc_reclaim_items_nr(root, to_reclaim); 4057 items = calc_reclaim_items_nr(root, to_reclaim);
4057 to_reclaim *= EXTENT_SIZE_PER_ITEM; 4058 to_reclaim = items * EXTENT_SIZE_PER_ITEM;
4058 4059
4059 trans = (struct btrfs_trans_handle *)current->journal_info; 4060 trans = (struct btrfs_trans_handle *)current->journal_info;
4060 block_rsv = &root->fs_info->delalloc_block_rsv; 4061 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,
4066 if (trans) 4067 if (trans)
4067 return; 4068 return;
4068 if (wait_ordered) 4069 if (wait_ordered)
4069 btrfs_wait_all_ordered_extents(root->fs_info); 4070 btrfs_wait_ordered_roots(root->fs_info, items);
4070 return; 4071 return;
4071 } 4072 }
4072 4073
@@ -4105,7 +4106,7 @@ skip_async:
4105 4106
4106 loops++; 4107 loops++;
4107 if (wait_ordered && !trans) { 4108 if (wait_ordered && !trans) {
4108 btrfs_wait_all_ordered_extents(root->fs_info); 4109 btrfs_wait_ordered_roots(root->fs_info, items);
4109 } else { 4110 } else {
4110 time_left = schedule_timeout_killable(1); 4111 time_left = schedule_timeout_killable(1);
4111 if (time_left) 4112 if (time_left)