summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-03-25 13:25:59 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-07 18:45:53 +0200
commitd38b349c39a9feb1aca82c3280b9b1234497d582 (patch)
treeec90b923cbcbc0d5c2b9bcf0275725afc2be34b3
parent31bada7c4e5e80b9cc031e89247175bed58ed9e9 (diff)
downloadlinux-d38b349c39a9feb1aca82c3280b9b1234497d582.tar.gz
linux-d38b349c39a9feb1aca82c3280b9b1234497d582.tar.bz2
linux-d38b349c39a9feb1aca82c3280b9b1234497d582.zip
Btrfs: don't bother kicking async if there's nothing to reclaim
We do this check when we start the async reclaimer thread, might as well check before we kick it off to save us some cycles. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/extent-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a012fd49f214..a0ca2b5914d0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4944,6 +4944,9 @@ static inline int need_do_async_reclaim(struct btrfs_space_info *space_info,
if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh)
return 0;
+ if (!btrfs_calc_reclaim_metadata_size(fs_info->fs_root, space_info))
+ return 0;
+
return (used >= thresh && !btrfs_fs_closing(fs_info) &&
!test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state));
}