From patchwork Thu Aug 13 21:23:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 7011001 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7751FC05AD for ; Thu, 13 Aug 2015 21:29:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D841205BB for ; Thu, 13 Aug 2015 21:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCE4E2068A for ; Thu, 13 Aug 2015 21:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754082AbbHMV3H (ORCPT ); Thu, 13 Aug 2015 17:29:07 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:36968 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754171AbbHMV3G (ORCPT ); Thu, 13 Aug 2015 17:29:06 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id A6D8622DA54; Thu, 13 Aug 2015 21:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1439501033; bh=YBxtTraVsIiWRWOl3RHbwHukJYiF8X/ XNnSkr7+LrAA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References; b=fXhY1qDlPY4ZYnUYWqZtWwP6G9ZNzJTG/Lc1t3PtV50On8hy5dn2 4Pky2cmPbeARN/Wh4yHOPnF0TG7a4fAVQ/GVIg7fayJEqn8PfTbusm20uqlT8STnXzU PV/QrkDUFzPPNnskJd0qVdz4CdTD35Sb+Ri4y4ogMkDaTBBLrZjY= From: "Nicholas A. Bellinger" To: stable Cc: Greg-KH , Al Viro , Miklos Szeredi , linux-fsdevel Subject: [PATCH-v3.14.y 3/8] new helper: dentry_free() Date: Thu, 13 Aug 2015 21:23:41 +0000 Message-Id: <1439501026-19955-4-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1439501026-19955-1-git-send-email-nab@linux-iscsi.org> References: <1439501026-19955-1-git-send-email-nab@linux-iscsi.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Al Viro commit b4f0354e968f5fabd39bc85b99fedae4a97589fe upstream. The part of old d_free() that dealt with actual freeing of dentry. Taken out of dentry_kill() into a separate function. Signed-off-by: Al Viro --- fs/dcache.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 1dc738a..3a0f252 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -244,6 +244,15 @@ static void __d_free(struct rcu_head *head) kmem_cache_free(dentry_cache, dentry); } +static void dentry_free(struct dentry *dentry) +{ + /* if dentry was never visible to RCU, immediate free is OK */ + if (!(dentry->d_flags & DCACHE_RCUACCESS)) + __d_free(&dentry->d_u.d_rcu); + else + call_rcu(&dentry->d_u.d_rcu, __d_free); +} + /** * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups * @dentry: the target dentry @@ -511,11 +520,7 @@ relock: if (dentry->d_op && dentry->d_op->d_release) dentry->d_op->d_release(dentry); - /* if dentry was never visible to RCU, immediate free is OK */ - if (!(dentry->d_flags & DCACHE_RCUACCESS)) - __d_free(&dentry->d_u.d_rcu); - else - call_rcu(&dentry->d_u.d_rcu, __d_free); + dentry_free(dentry); return parent; }