From patchwork Fri Mar 25 17:25:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 8672621 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5FE219FC57 for ; Fri, 25 Mar 2016 17:26:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A390202E5 for ; Fri, 25 Mar 2016 17:26:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B312D20303 for ; Fri, 25 Mar 2016 17:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754194AbcCYR0j (ORCPT ); Fri, 25 Mar 2016 13:26:39 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:43963 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754159AbcCYR0b (ORCPT ); Fri, 25 Mar 2016 13:26:31 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u2PHOJq5008887 for ; Fri, 25 Mar 2016 10:26:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=oEd5BYLwJjlj+WTskF9GAOqQfpi5pVpGACmilb9FroI=; b=b1h2zKW1+qdhWkzoz+er1qEDlYMVvnNsUa6ZXosfbOBPQKMCVIZemRNW4En7OM4aQWaI ZxzSvBgkri6v7n4FSWM+5iL+wMJqaqju0XRP5oqDU9JlXe6wAkYJD7wF2j45N1/2KuUj Npub3UBUEeiOqh732khMKmzmLAvSvBgQg5o= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 21vybh2pkf-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 25 Mar 2016 10:26:30 -0700 Received: from localhost (192.168.52.123) by mail.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 25 Mar 2016 10:26:28 -0700 From: Josef Bacik To: Subject: [PATCH 13/14] Btrfs: don't bother kicking async if there's nothing to reclaim Date: Fri, 25 Mar 2016 13:25:59 -0400 Message-ID: <1458926760-17563-14-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458926760-17563-1-git-send-email-jbacik@fb.com> References: <1458926760-17563-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-03-25_04:, , signatures=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- fs/btrfs/extent-tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 273e18d..4b5a517 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4871,6 +4871,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)); }