]> git.hungrycats.org Git - linux/commitdiff
Btrfs: don't bother kicking async if there's nothing to reclaim
authorJosef Bacik <jbacik@fb.com>
Fri, 25 Mar 2016 17:25:59 +0000 (13:25 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Wed, 17 Aug 2016 02:35:11 +0000 (22:35 -0400)
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>
(cherry picked from commit d38b349c39a9feb1aca82c3280b9b1234497d582)

fs/btrfs/extent-tree.c

index 381ad6943b290fc08b963d440a87548b69d9b1e7..fa5dccb83a39ae5dcfd0235613a413b6abf70344 100644 (file)
@@ -4870,6 +4870,9 @@ static inline int need_do_async_reclaim(struct btrfs_space_info *space_info,
        if (space_info->bytes_used >= 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));
 }