From patchwork Tue Nov 1 15:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Lyashkov X-Patchwork-Id: 9407497 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 05B9A60234 for ; Tue, 1 Nov 2016 15:01:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9325299AC for ; Tue, 1 Nov 2016 15:01:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9A90299AE; Tue, 1 Nov 2016 15:01:35 +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 6A070299AC for ; Tue, 1 Nov 2016 15:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966657AbcKAPBe (ORCPT ); Tue, 1 Nov 2016 11:01:34 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36172 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966637AbcKAPBd (ORCPT ); Tue, 1 Nov 2016 11:01:33 -0400 Received: by mail-lf0-f68.google.com with SMTP id o20so3312434lfg.3 for ; Tue, 01 Nov 2016 08:01:32 -0700 (PDT) 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=kL7hs1dUns1nksbgMCvUKfmdyB3HJy8O+MoFNicssQI=; b=LBBxoR8PQGSUmiAAqjwtKhCLVjWWBx/6kLSzhpzpw4SjKnfPZz2WUSnV+C6MdUuOoh Vr76YXP7vFjxXkb/8qKxiX6pt6iG+UrJc1PrLUCYXUWiCjUS3FaYlxuvd+DmDPN9EvTU K4OV1ie1u1GWbu3JrVChqwUnWtbQYBQ7ghWqwzDinhsBLc4QbUU0yDEPi1X2K8grofJP LSTGHK/noUISuciqGn5ZfIkDRTjkQCGwNz4+s1vgaL+qBrYAA5S+ihTg5JkFWr+ii5pa Zl6BobzCiG0g3dFhz2rSgmvHh9Cf4WHaNDEpwuK0p7+ZM4w3Iuu19dFPqCjUNPevjtxd R5Og== 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=kL7hs1dUns1nksbgMCvUKfmdyB3HJy8O+MoFNicssQI=; b=fDKbSWlaHaK/+EaB6NeVLAIo9DmYbf5ZttvDfvJe6xpBVY4oDODElyQRfobxNECGOk RFvulKgOVI0X47NrwtbMneDXLZphQDjmIROeky5MozLV8UhdhiMFVhMsYN65wuN4UEZe SjzyGNia0Z3mQmcAI/hdbmQNnzfwJBAjVaqxO8tqbRkjyobBmZxuJGWS7DoMKZ948sVz qMQa0kqkAXUqvyw+7udLpqhbydvADflRXe2l9R6NoiT96ON4qV/fRz4uQcPk+mJCZkTI K0uci90IzKvKvkR38vCIxKtcenTgMQUGGgkQ4c/nNsWJ//T3xnVSBszRoOeVPS+irYJW Ue8Q== X-Gm-Message-State: ABUngvdjxrtFxbRXEPcFyU6byeVRwuY4TqN3IboYZSG9J+p+OGrskhN+yA9bM5DRm9xQbw== X-Received: by 10.25.44.66 with SMTP id s63mr21119903lfs.69.1478012491657; Tue, 01 Nov 2016 08:01:31 -0700 (PDT) Received: from alexeys-macbook-pro.local ([2a00:1a28:155b:2::100f]) by smtp.gmail.com with ESMTPSA id h138sm5480173lfe.24.2016.11.01.08.01.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 08:01:30 -0700 (PDT) Subject: [PATCH v2 2/2] cleanup of d_unhashed usage. From: Alexey Lyashkov To: linux-fsdevel@vger.kernel.org Cc: Andreas Dilger , Jan Kara , Al Viro Date: Tue, 01 Nov 2016 18:01:28 +0300 Message-ID: <147801245780.67124.6180063438785237544.stgit@alexeys-macbook-pro.local> In-Reply-To: <147801228331.67124.8779865197533529488.stgit@alexeys-macbook-pro.local> References: <147801228331.67124.8779865197533529488.stgit@alexeys-macbook-pro.local> User-Agent: StGit/0.17-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 We don't need to hold a d_lock / d_seq locks while d_unhashed checking. Lets do these locks 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) {