From patchwork Tue Sep 11 17:57:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10596057 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 EE41F14E5 for ; Tue, 11 Sep 2018 17:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9C8D297E4 for ; Tue, 11 Sep 2018 17:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD4A3297F7; Tue, 11 Sep 2018 17:58:20 +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 796C5297E4 for ; Tue, 11 Sep 2018 17:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728173AbeIKW6o (ORCPT ); Tue, 11 Sep 2018 18:58:44 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:44493 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbeIKW6o (ORCPT ); Tue, 11 Sep 2018 18:58:44 -0400 Received: by mail-qt0-f194.google.com with SMTP id k38-v6so29172417qtk.11 for ; Tue, 11 Sep 2018 10:58:18 -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=E8JF94eruCVpfwCQjNtPgc8hW7YmBCNIla9LHGUTiOs=; b=h0MMId7a2rthheVJqmll3u4AxI5zf5cQbGrCfhDo64xQEKwi1n2Dr2w2cscIBWpMpt aQyHpGFufe0MKKVOuh61RI9qrR263ycMBp0KOVEvWnDMJg2VTremWnSQa6o63tUI4GQC HDH6Bj5qC7UzLwD+H8XLKYE99DR6R1Xi/lQjoJmzqHgZSas98wjNb7+SDBpwD+txV0Pz ZHD8s+XkgF5S1ZoXvBAFcYr3VrOObIyxyUfRYJuC/s3+pUtgPokKZ+7djrNOMMi/PV/d zeLJq1Gwc/4S+wYjPeQG7AY/rsMAeuHtPX3DpxHgPxf/ZWFJK0u29GN5+KL2RJud1fLF TSfA== 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=E8JF94eruCVpfwCQjNtPgc8hW7YmBCNIla9LHGUTiOs=; b=lHEtu0RJFyCbJAGJa4OLVmRb9EbViD5FsJS9m3Q92f2zugkFNhlAWBoic8iINeRpss 4dwR981VqZ0G+tqfRWVC3CqL5ONtFcSOIsgK0kZAHg73f6sLQ5EO7eEngW7DkIRrP44E 7qOmv2G24QeTIHX3YQiTjOEmwavbuEHGBEZSf1ii8VRljTiLIKrSWRymZSBJl7ZCQvP1 rNVMIrpCeN+fkiiotvg/2xgA48NHaxhUVxj5pdJio/UyqAOK0XzAEvfbk9bVHdniKowR N/13Vyv7wX9nrjvo00RVja+vd7yVF+oI5Be6xJv5tMsp1UCQJKgIZhOTOcwlRpv9BnN9 XHHA== X-Gm-Message-State: APzg51AxGzElVwLLp9woEUmv51IpRNZg/oJkBWuUZpSd+nxu4KyXdlSB VF5RnOMDCIbDZtiFNR2LgicdNQ== X-Google-Smtp-Source: ANB0VdZeAxFqI1W2/J/kVoqn2ZblGbw9QVe4HG8W1CBfKsBlkq+7iFYfne7xYMf+ZtVjov+AsU40aw== X-Received: by 2002:a0c:ec47:: with SMTP id n7-v6mr19141329qvq.56.1536688698367; Tue, 11 Sep 2018 10:58:18 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id m95-v6sm10556962qte.69.2018.09.11.10.58.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 10:58:17 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 04/36] btrfs: only track ref_heads in delayed_ref_updates Date: Tue, 11 Sep 2018 13:57:35 -0400 Message-Id: <20180911175807.26181-5-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 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. Fix the accounting to only be adjusted when we add/remove a ref head. Signed-off-by: Josef Bacik --- fs/btrfs/delayed-ref.c | 3 --- 1 file changed, 3 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; }