From patchwork Thu Aug 30 17:41:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10582431 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 E1E565A4 for ; Thu, 30 Aug 2018 17:42:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF1A52C342 for ; Thu, 30 Aug 2018 17:42:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C36D52C35E; Thu, 30 Aug 2018 17:42:38 +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 660A62C342 for ; Thu, 30 Aug 2018 17:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727251AbeH3Vpv (ORCPT ); Thu, 30 Aug 2018 17:45:51 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:34809 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726727AbeH3Vpv (ORCPT ); Thu, 30 Aug 2018 17:45:51 -0400 Received: by mail-qt0-f195.google.com with SMTP id m13-v6so11331653qth.1 for ; Thu, 30 Aug 2018 10:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4X46/4+31Z+2yhmkaoQ1ZOza/zHxNuIbkb2dmlVKMr4=; b=WWMnXi0n2pkVIRmXoxE3Gmr0wReurmT8LLUDAjtLDVh0NxOIR6w2ZNgEb/1q3LpNFE kCjf6+MAUQQV+ao4iwnaIIGJGYW2s8HoOK3NBy7UdaYNqZsiNoJk6dJDV8Rb9fkbJwaZ OWglkdcOWbVtOpXbctZ2vVc+aPFsM56HR+AuK3x5ZWBcHIrpGROmER4S91oc89fM0PT0 KZwO9DSQ1tNaU+WtGgGE3JDSZQfxA+fnC1jUtIiKKn0xigAD+rAzCVu15QVOzMnWtBMW 6TBt1iaLWQvq4qB8X0d4J3bwSRW7dN4ybDUcFbQSYNjKszWUqMTrS5OUreEvXpW02zPR +ySg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4X46/4+31Z+2yhmkaoQ1ZOza/zHxNuIbkb2dmlVKMr4=; b=HQWMKCKexCcWmmhRH0slLPsuEWCqjPWJZmrqvSRS1WccyZ0HhYCdJ/rNOOjnRzJ6l2 YViqSRwDm+YQPdvczhjrv8CooPOX4iLxuFvsJF2KwO4M5b2vDAIVLka0gItytfVUjoRj 7BHj4GeObrl3DbXYAoWKIjddTJ6togGQHwHAuC7HWcQBD7zaPMp42fE/pyE7IlqOvXJr 5K8Xpj41q+TtC8pxYpWo3US6ynldPsNDciNLb+5J7pel/2PF8ROWZ9Q0CMlGsulsJXJR RYEdIu08ubsvl6iH6wFeHWf6ke1KBiBXmbO8OZqmKYP9xs+6XsWWhFh43d8oW7cFz6pn ngUA== X-Gm-Message-State: APzg51DUAMbitB2n45cP8wXrlxJQH5f20BWnwiuZirrZ+yoqr1iV9DYK purVKjmLTCWtIMUWPfZBBPjyo5zm9ZntxA== X-Google-Smtp-Source: ANB0VdatUAPzbMqOGjNuqELSjcquP00MH7l18dvs2opyUbTX5rQjuUvV7Nd6p/A9NB27488VQuvrzQ== X-Received: by 2002:a0c:9953:: with SMTP id i19-v6mr12227837qvd.122.1535650955697; Thu, 30 Aug 2018 10:42:35 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id m9-v6sm4947928qta.55.2018.08.30.10.42.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 10:42:34 -0700 (PDT) From: Josef Bacik To: linux-btrfs@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 04/35] btrfs: only track ref_heads in delayed_ref_updates Date: Thu, 30 Aug 2018 13:41:54 -0400 Message-Id: <20180830174225.2200-5-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180830174225.2200-1-josef@toxicpanda.com> References: <20180830174225.2200-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 From: Josef Bacik We use this number to figure out how many delayed refs to run, but __btrfs_run_delayed_refs really only checks every time we need a new delayed ref head, so we always run at least one ref head completely no matter what the number of items on it. So instead track only the ref heads added by this trans handle and adjust the counting appropriately in __btrfs_run_delayed_refs. Signed-off-by: Josef Bacik --- fs/btrfs/delayed-ref.c | 3 --- fs/btrfs/extent-tree.c | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 3a9e4ac21794..27f7dd4e3d52 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -234,8 +234,6 @@ static inline void drop_delayed_ref(struct btrfs_trans_handle *trans, ref->in_tree = 0; btrfs_put_delayed_ref(ref); atomic_dec(&delayed_refs->num_entries); - if (trans->delayed_ref_updates) - trans->delayed_ref_updates--; } static bool merge_ref(struct btrfs_trans_handle *trans, @@ -460,7 +458,6 @@ static int insert_delayed_ref(struct btrfs_trans_handle *trans, if (ref->action == BTRFS_ADD_DELAYED_REF) list_add_tail(&ref->add_list, &href->ref_add_list); atomic_inc(&root->num_entries); - trans->delayed_ref_updates++; spin_unlock(&href->lock); return ret; } diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 87c42a2c45b1..20531389a20a 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2583,6 +2583,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 */ @@ -2596,7 +2597,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, */ if (ret == -EAGAIN) { locked_ref = NULL; - count++; continue; } } @@ -2624,7 +2624,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; } @@ -2642,7 +2641,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, return ret; } locked_ref = NULL; - count++; continue; } @@ -2693,7 +2691,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, } btrfs_put_delayed_ref(ref); - count++; cond_resched(); }