From patchwork Thu Dec 1 04:18:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Lyashkov X-Patchwork-Id: 9455341 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 C7ACE60515 for ; Thu, 1 Dec 2016 04:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B902A2847D for ; Thu, 1 Dec 2016 04:19:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA981284C2; Thu, 1 Dec 2016 04:19:39 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 60A722847D for ; Thu, 1 Dec 2016 04:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754848AbcLAETh (ORCPT ); Wed, 30 Nov 2016 23:19:37 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33963 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcLAETg (ORCPT ); Wed, 30 Nov 2016 23:19:36 -0500 Received: by mail-lf0-f68.google.com with SMTP id o141so17836366lff.1 for ; Wed, 30 Nov 2016 20:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=yvuw0lpVvNYn5flcgRQB4sOH0cnmIrHBGF36yfzbGXU=; b=i0viBGhxusFnjeQDj/V7xqpzOZG5jlHG6WhPYoZhdD5dL+fO5ZGffLxNlGzJxI9MEp a7e8Fh0QQbv/28jvcsdJQPBvpjxAp+JwnPfK/u5ZkDAB399UxNeLB5YgtjpJxtyDLO3a lUWLUt52D/Q2c6MeBoPmWSyJmiYAFVzQTT3VMwVqDj9yVV70jwNwiJ0CCw3sO5P6DwO/ vIS0zEbILI6ijOni1ZbLXwHRiWvVw7dxUKKssiSIR29iGNEFtNpz9ac1ck1zPgmYT/CY NSUg5q8DqT6zEERpAKIjXLdlsHJqKW3VldYV6OoU5zRkHYPSajf1IOZ+NCReNSnS+7Mg bmhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=yvuw0lpVvNYn5flcgRQB4sOH0cnmIrHBGF36yfzbGXU=; b=kIGuaisVfCGiIIilAp4oMgBAHMZq2eOBdvhl6zmNWiNh8c3Cj7jcwl5mf2KOeLx9rL wRNuhnP6En6jS50HAG4xUBovz69NOss1AFuv6s/ZoiV7nL0fsUOJRxEJvBnafmezFBI2 NrThnr8qeHauGlSMxadmyKw8Gg4c0v2cFdpHgHQwRblD3ZAYuNEzP44dVzI6v8/YVKQx 7qAANrreEoKkiCnqezn9++cuNJ5/ALfbuM4kwTFLHBpDN0KU/nQkFs/tVrTmCSNnVpkE NCQflUk+9GhBWtjPwg8Q78MwEfDVY/xghIXH6aQ8U5tu8SMtLegZkaEMONYbeK5fn1t+ qVwg== X-Gm-Message-State: AKaTC03AHw9bWgQuwM9oTkqkApWgKHePhooLrZ/2lR3BSvy8mrFEKJC7j0yCb6pNQy044Q== X-Received: by 10.25.22.166 with SMTP id 38mr14390526lfw.11.1480565923269; Wed, 30 Nov 2016 20:18:43 -0800 (PST) Received: from alexeys-macbook-pro.local ([2a00:1a28:155b:5::1016]) by smtp.gmail.com with ESMTPSA id h3sm15144209lfj.27.2016.11.30.20.18.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 20:18:42 -0800 (PST) Subject: [PATCH 2/2] cleanup of d_unhashed usage. From: Alexey Lyashkov To: linux-fsdevel@vger.kernel.org Cc: Andreas Dilger , Andrew Perepechko , Jan Kara , Al Viro Date: Thu, 01 Dec 2016 07:18:41 +0300 Message-ID: <148056591362.28852.5752789726339637370.stgit@alexeys-macbook-pro.local> In-Reply-To: <148056480133.28852.8559789719521724209.stgit@alexeys-macbook-pro.local> References: <148056480133.28852.8559789719521724209.stgit@alexeys-macbook-pro.local> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Once a d_unhashed vs d_move race resolved, we don’t need to hold a d_lock while simple check. Let’s do d_lock less hot. Signed-off-by: Alexey Lyashkov --- fs/dcache.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/dcache.c b/fs/dcache.c index 0863841..c23effb 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1327,12 +1327,8 @@ int d_set_mounted(struct dentry *dentry) write_seqlock(&rename_lock); for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) { /* Need exclusion wrt. d_invalidate() */ - spin_lock(&p->d_lock); - if (unlikely(d_unhashed(p))) { - spin_unlock(&p->d_lock); + if (unlikely(d_unhashed(p))) goto out; - } - spin_unlock(&p->d_lock); } spin_lock(&dentry->d_lock); if (!d_unlinked(dentry)) { @@ -1510,12 +1506,8 @@ void d_invalidate(struct dentry *dentry) /* * If it's already been dropped, return OK. */ - spin_lock(&dentry->d_lock); - if (d_unhashed(dentry)) { - spin_unlock(&dentry->d_lock); + if (d_unhashed(dentry)) return; - } - spin_unlock(&dentry->d_lock); /* Negative dentries can be dropped without further checks */ if (!dentry->d_inode) {