From patchwork Fri Sep 29 19:43:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9978553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F137460311 for ; Fri, 29 Sep 2017 19:44:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A29298AB for ; Fri, 29 Sep 2017 19:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D84DF298AD; Fri, 29 Sep 2017 19:44:28 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 6B385298AB for ; Fri, 29 Sep 2017 19:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554AbdI2To1 (ORCPT ); Fri, 29 Sep 2017 15:44:27 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:36037 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbdI2ToZ (ORCPT ); Fri, 29 Sep 2017 15:44:25 -0400 Received: by mail-qk0-f194.google.com with SMTP id z14so406565qkg.3 for ; Fri, 29 Sep 2017 12:44:24 -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=RtfEBgfNdYUn1gDkThhI9kR2q1ZaM0AgbRQndaG/n8Y=; b=oLqVxn1Fd4yfVqc1QJ7P+mxR15/EVBEeWH5FwnFRryApl/d0nlYmH/yrxvqEv7gbux yKY3oBusvsVrmrqz03JEbD4SrvT7WOgMw+Vkmix4O+khg2I5pzIcFIVJaQzctxQfThhf B3h8sviHehZL4bmNkYotRkRlo1jzu2J7XUxwu5ZBAkb4wH4/pkW+uZ2E3YmAFgZvCN2r Z65ujRYHfZ8dKsjwl1E47y+AzEnTSqjp5Ko+GMlbDVHJa1TD4zq591Waygm66uitli4P XT+mUr/93M4bPApQl94wym4Fyz+h77sn11r4G3tg1lt5uVVRzkAJ5eJs6fgv/XOsqXTa v0lw== 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=RtfEBgfNdYUn1gDkThhI9kR2q1ZaM0AgbRQndaG/n8Y=; b=tz3ON5yKHR7Wz+cn6lQ07q3oHDA8rBNxSJhJafUP9MMr9+HAR7nQJ6dnNajPaGJk92 O0wc8uaLKquviyavYtHr7uh4VDMceSiLWlK84/B8aCd9uB5Cb66CCHmjRHFMwGqg1r5c RMYcP00I1qy5MiO++fc6uvu9m6ZSRQ3ggYItdeTKfld/PTOmKWtufmJ5cfAG7VIAeciL Eh0nST6Iv90Bqwkl3nHL95JHGxlkFEOnNMfzGfW3qIHC5kQn5lWWXPkZsSa4Ulo4QRYC 8Wfo5eagcD6xOiT1aLZAvvMkWRI3hXx/tmbaJtkDXqwgMUip2SYp3yR8TbkZWlmJVzM7 ZWrg== X-Gm-Message-State: AMCzsaWojIAcIgOPcyY8utdoRJwgYl+LwH68gZFbengl1V+e1Qt3wMxT JOlnbmPuvSGQPpso0RkXm6O4qw== X-Google-Smtp-Source: AOwi7QD/eeVPqqGfOVq5mMlAz1Zb+PkKN7eZm4Xj5mKlzeJHFCUrO62Gx3XEEIjCcMVZQXAGUljGpA== X-Received: by 10.233.244.72 with SMTP id z8mr4861147qkl.186.1506714264356; Fri, 29 Sep 2017 12:44:24 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id m18sm3186272qtb.77.2017.09.29.12.44.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 12:44:23 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH 11/21] btrfs: move ref_mod modification into the if (ref) logic Date: Fri, 29 Sep 2017 15:43:55 -0400 Message-Id: <1506714245-23072-12-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506714245-23072-1-git-send-email-jbacik@fb.com> References: <1506714245-23072-1-git-send-email-jbacik@fb.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 only use this logic if our ref isn't a ref_head, so move it up into the if (ref) case since we know that this is a normal ref and not a delayed ref head. Signed-off-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/extent-tree.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index bae2eac11db7..ac1196af6b7e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2745,10 +2745,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, list_del(&ref->list); if (!list_empty(&ref->add_list)) list_del(&ref->add_list); - } - atomic_dec(&delayed_refs->num_entries); - - if (!btrfs_delayed_ref_is_head(ref)) { /* * when we play the delayed ref, also correct the * ref_mod on head @@ -2765,6 +2761,8 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, WARN_ON(1); } } + atomic_dec(&delayed_refs->num_entries); + /* * record the must insert reserved flag before we * drop the spin lock.