Commit 365c5313 authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

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: default avatarChris Mason <clm@fb.com>
parent cb723e49
...@@ -4329,8 +4329,13 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_root *root, ...@@ -4329,8 +4329,13 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_root *root,
static inline int need_do_async_reclaim(struct btrfs_space_info *space_info, static inline int need_do_async_reclaim(struct btrfs_space_info *space_info,
struct btrfs_fs_info *fs_info, u64 used) struct btrfs_fs_info *fs_info, u64 used)
{ {
return (used >= div_factor_fine(space_info->total_bytes, 98) && u64 thresh = div_factor_fine(space_info->total_bytes, 98);
!btrfs_fs_closing(fs_info) &&
/* If we're just plain full then async reclaim just slows us down. */
if (space_info->bytes_used >= thresh)
return 0;
return (used >= thresh && !btrfs_fs_closing(fs_info) &&
!test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)); !test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state));
} }
...@@ -4385,10 +4390,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) ...@@ -4385,10 +4390,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
if (!btrfs_need_do_async_reclaim(space_info, fs_info, if (!btrfs_need_do_async_reclaim(space_info, fs_info,
flush_state)) flush_state))
return; return;
} while (flush_state <= COMMIT_TRANS); } while (flush_state < COMMIT_TRANS);
if (btrfs_need_do_async_reclaim(space_info, fs_info, flush_state))
queue_work(system_unbound_wq, work);
} }
void btrfs_init_async_reclaim_work(struct work_struct *work) void btrfs_init_async_reclaim_work(struct work_struct *work)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment