From patchwork Tue Sep 11 17:57:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10596059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2825714BD for ; Tue, 11 Sep 2018 17:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 148A0297E4 for ; Tue, 11 Sep 2018 17:58:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08C84297F7; Tue, 11 Sep 2018 17:58:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9BF4297E4 for ; Tue, 11 Sep 2018 17:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbeIKW6q (ORCPT ); Tue, 11 Sep 2018 18:58:46 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:41648 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbeIKW6q (ORCPT ); Tue, 11 Sep 2018 18:58:46 -0400 Received: by mail-qt0-f195.google.com with SMTP id t39-v6so29163960qtc.8 for ; Tue, 11 Sep 2018 10:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=+yz3n6lATRx6h1PNpaQrCmKxcZVsI4n1UZsZzxSFbKc=; b=ev5jvlxM1Pq/H9IoDO1buG9+4RPitO6tpW/NHSHNFmFOZ9/IPWwzPo++E+TaloGzsC lTLNkj+ckdP16R1qJsyR8+ih7bVwi2USAKHfcPjjo5o4C5Iku9LuYtOi8SyDwT2kG+tN o/6K4629aaB34r6g3OLeeOGU+gArLJ/G2vJ1WtWAjJxoHdA4moxg5jE01a3opb6c7J8g Ezx0tKAo2mVaNBtqXIP0qVXwsAsTVJ0LV107ODnaSroc0fmya8oVRk28mp/juz2klCvv j3WGGfAPcWSZSSEtg3QyrORDjJkxKYJG88n6rurhxGHYS3NmbT2QZE/cedfao2wv5NwK etzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+yz3n6lATRx6h1PNpaQrCmKxcZVsI4n1UZsZzxSFbKc=; b=kVCL+zWdnyYTZOgZyt2DDtoVMXq9nMBOB32Bg887nxxEDgqXtlU3xbpE6Zgeda+EKx PlQ9BZsBvCi8JsWuYXsbukJoVAbrH/NdMqcRhlAJbxjeJBoUKbJTrmnpTfuRQ7z/0g4L IyjHCiYgzmVmOuSEpPV987dq0uxCN0jncbQj5eF6DX+Ei2uKh3gozt6/vLQ5t7o44NnO AUqS7RGUzsRxNYghR7v3vPJvvegxU9O0vFEgDMycxQF/56ezBCavIJsO7wF/rnu77dDY VsZjM/tp/o5Z7qYqLOSTyeB8BzYpe6qzC6YbffctPeuG90rKeAAZZbWl5pCtamj3nTv4 8tcg== X-Gm-Message-State: APzg51B0eU6znavDVuBmkyl9mrg3puFlco29w/+gsVmpv6fpBfne8NTz HZpnqq6qKF7XDgbvhXDJMmvWhA== X-Google-Smtp-Source: ANB0Vdasu7Mw4pgZHpm9gBqWf0w3GA/N3zB+XRIrJcwBnzcfL1lt6pvGjXlbxMsHU1rIb5gPkJ5eWg== X-Received: by 2002:aed:2fe6:: with SMTP id m93-v6mr21209232qtd.76.1536688700115; Tue, 11 Sep 2018 10:58:20 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id 53-v6sm12169234qto.61.2018.09.11.10.58.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 10:58:19 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH 05/36] btrfs: only count ref heads run in __btrfs_run_delayed_refs Date: Tue, 11 Sep 2018 13:57:36 -0400 Message-Id: <20180911175807.26181-6-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180911175807.26181-1-josef@toxicpanda.com> References: <20180911175807.26181-1-josef@toxicpanda.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We pick the number of ref's to run based on the number of ref heads, and only make the decision to stop once we've processed entire ref heads, so only count the ref heads we've run and bail once we've hit the number of ref heads we wanted to process. Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 98f36dfeccb0..b32bd38390dd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2592,6 +2592,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, spin_unlock(&delayed_refs->lock); break; } + count++; /* grab the lock that says we are going to process * all the refs for this head */ @@ -2605,7 +2606,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, */ if (ret == -EAGAIN) { locked_ref = NULL; - count++; continue; } } @@ -2633,7 +2633,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, unselect_delayed_ref_head(delayed_refs, locked_ref); locked_ref = NULL; cond_resched(); - count++; continue; } @@ -2651,7 +2650,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, return ret; } locked_ref = NULL; - count++; continue; } @@ -2702,7 +2700,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, } btrfs_put_delayed_ref(ref); - count++; cond_resched(); }