diff options
author | Josef Bacik <jbacik@fb.com> | 2015-02-18 16:58:15 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-10 17:06:54 -0400 |
commit | 365c5313776730acf433d54226f0216a1d075e9a (patch) | |
tree | 3b9767744b06cd31f6af3ca122465039d60b47f1 /fs | |
parent | cb723e491955ac11a1591ae25cada7c3b1470609 (diff) |
Btrfs: don't commit the transaction in the async space flushing
We're triggering a huge number of commits from
btrfs_async_reclaim_metadata_space. These aren't really requried,
because everyone calling the async reclaim code is going to end up
triggering a commit on their own.
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ae8db3ba467c..3d4b3d680fea 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4329,8 +4329,13 @@ out: | |||
4329 | static inline int need_do_async_reclaim(struct btrfs_space_info *space_info, | 4329 | static inline int need_do_async_reclaim(struct btrfs_space_info *space_info, |
4330 | struct btrfs_fs_info *fs_info, u64 used) | 4330 | struct btrfs_fs_info *fs_info, u64 used) |
4331 | { | 4331 | { |
4332 | return (used >= div_factor_fine(space_info->total_bytes, 98) && | 4332 | u64 thresh = div_factor_fine(space_info->total_bytes, 98); |
4333 | !btrfs_fs_closing(fs_info) && | 4333 | |
4334 | /* If we're just plain full then async reclaim just slows us down. */ | ||
4335 | if (space_info->bytes_used >= thresh) | ||
4336 | return 0; | ||
4337 | |||
4338 | return (used >= thresh && !btrfs_fs_closing(fs_info) && | ||
4334 | !test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)); | 4339 | !test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)); |
4335 | } | 4340 | } |
4336 | 4341 | ||
@@ -4385,10 +4390,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) | |||
4385 | if (!btrfs_need_do_async_reclaim(space_info, fs_info, | 4390 | if (!btrfs_need_do_async_reclaim(space_info, fs_info, |
4386 | flush_state)) | 4391 | flush_state)) |
4387 | return; | 4392 | return; |
4388 | } while (flush_state <= COMMIT_TRANS); | 4393 | } while (flush_state < COMMIT_TRANS); |
4389 | |||
4390 | if (btrfs_need_do_async_reclaim(space_info, fs_info, flush_state)) | ||
4391 | queue_work(system_unbound_wq, work); | ||
4392 | } | 4394 | } |
4393 | 4395 | ||
4394 | void btrfs_init_async_reclaim_work(struct work_struct *work) | 4396 | void btrfs_init_async_reclaim_work(struct work_struct *work) |