From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE07BC28CC6 for ; Mon, 3 Jun 2019 13:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9838927E5E for ; Mon, 3 Jun 2019 13:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559568686; bh=/jZ8CPirphc3NTxeejPO2up85CvS1kEsbbkCzDT3jGk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=peu7M26Izur15kJ6yvN7gpmPwiRUwEz/FME9QF3S4NZoXEv7PhkKiiiP2+HtRZfED ZkAQNGTx3QzQbOjxKkdatsrVA/rx1i4JeSLA1XB5+UWuiFfqXIJD7o1oqzcit/+sfm CrWqwenSES+vVfwoOa71aLqcGjrDFjzffszG6t04= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbfFCNbZ (ORCPT ); Mon, 3 Jun 2019 09:31:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:46296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbfFCNbZ (ORCPT ); Mon, 3 Jun 2019 09:31:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44AA327DB3; Mon, 3 Jun 2019 13:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559568684; bh=/jZ8CPirphc3NTxeejPO2up85CvS1kEsbbkCzDT3jGk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u3ps8LXR96wG5IJvv4FS5U9GPaSAE7Ze5hPnOM8aVbDnhsxXL0tsuV38WF8RGvKdc bN2Nm5CKXvH9xObtTWt57QzBt8FKDuAlX/BnqhJIAB7jiikSFCJBCEQApNhKK/4kwD HBvIJN0AXLMt6TN635Jhejqtk300cr2JGVUksZJk= Date: Mon, 3 Jun 2019 15:31:22 +0200 From: Greg Kroah-Hartman To: Amir Goldstein Cc: Jan Kara , David Sterba , Christoph Hellwig , Joel Becker , John Johansen , Trond Myklebust , Anna Schumaker , Steven Rostedt , Al Viro , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3 06/10] debugfs: simplify __debugfs_remove_file() Message-ID: <20190603133122.GA24574@kroah.com> References: <20190526143411.11244-1-amir73il@gmail.com> <20190526143411.11244-7-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190526143411.11244-7-amir73il@gmail.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sun, May 26, 2019 at 05:34:07PM +0300, Amir Goldstein wrote: > Move simple_unlink()+d_delete() from __debugfs_remove_file() into > caller __debugfs_remove() and rename helper for post remove file to > __debugfs_file_removed(). > > This will simplify adding fsnotify_unlink() hook. > > Cc: Greg Kroah-Hartman > Signed-off-by: Amir Goldstein > --- > fs/debugfs/inode.c | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c > index acef14ad53db..d89874da9791 100644 > --- a/fs/debugfs/inode.c > +++ b/fs/debugfs/inode.c > @@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, > } > EXPORT_SYMBOL_GPL(debugfs_create_symlink); > > -static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent) > +static void __debugfs_file_removed(struct dentry *dentry) > { > struct debugfs_fsdata *fsd; > > - simple_unlink(d_inode(parent), dentry); > - d_delete(dentry); > - > /* > * Paired with the closing smp_mb() implied by a successful > * cmpxchg() in debugfs_file_get(): either > @@ -644,16 +641,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) > > if (simple_positive(dentry)) { > dget(dentry); > - if (!d_is_reg(dentry)) { > - if (d_is_dir(dentry)) > - ret = simple_rmdir(d_inode(parent), dentry); > - else > - simple_unlink(d_inode(parent), dentry); > - if (!ret) > - d_delete(dentry); > + if (d_is_dir(dentry)) { > + ret = simple_rmdir(d_inode(parent), dentry); > } else { > - __debugfs_remove_file(dentry, parent); > + simple_unlink(d_inode(parent), dentry); > } > + if (!ret) > + d_delete(dentry); > + if (d_is_reg(dentry)) > + __debugfs_file_removed(dentry); > dput(dentry); > } > return ret; Ugh, I had to stare at this for a long time. I _think_ it all looks equalivant now, but if this breaks, I know who to blame :) Reviewed-by: Greg Kroah-Hartman