From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: [patch 5/9] fs: remove unneeded DCACHE_UNHASHED tricks Date: Wed, 18 Nov 2009 05:29:14 +0100 Message-ID: <20091118042914.GD21813@wotan.suse.de> References: <200911172256.nAHMuUSi027629@imap1.linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, davem@davemloft.net, davidel@xmailserver.org, hch@lst.de, jens.axboe@oracle.com, mszeredi@suse.cz To: akpm@linux-foundation.org Return-path: Received: from cantor.suse.de ([195.135.220.2]:34969 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755055AbZKRE3J (ORCPT ); Tue, 17 Nov 2009 23:29:09 -0500 Content-Disposition: inline In-Reply-To: <200911172256.nAHMuUSi027629@imap1.linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Nov 17, 2009 at 02:56:30PM -0800, Andrew Morton wrote: > From: Nick Piggin > > Filesystems outside the regular namespace do not have to clear > DCACHE_UNHASHED in order to have a working /proc/$pid/fd/XXX. Nothing in > proc prevents the fd link from being used if its dentry is not in the > hash. > > Also, it does not get put into the dcache hash if DCACHE_UNHASHED is > clear; that depends on the filesystem calling d_add or d_rehash. > > So delete the misleading comments and needless code. Thanks for carrying this for me Andrew, I'm sorry it slipped my mind that you had it in your tree -- it just requires a small update to fix the /proc/pid/fd link path name for anonfs. -- fs: anon_inodes implement dname Add a d_dname method for anon_inodes filesystem, the same way pipefs and sockfs pseudo filesystems. This allows us to remove the DCACHE_UNHASHED hack from anon_inodes.c (see next patch). Signed-off-by: Nick Piggin --- fs/anon_inodes.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Index: linux-2.6/fs/anon_inodes.c =================================================================== --- linux-2.6.orig/fs/anon_inodes.c +++ linux-2.6/fs/anon_inodes.c @@ -45,6 +45,15 @@ static int anon_inodefs_delete_dentry(st return 1; } +/* + * anon_inodefs_dname() is called from d_path(). + */ +static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen) +{ + return dynamic_dname(dentry, buffer, buflen, "anon_inode:%s", + dentry->d_name.name, dentry->d_inode->i_ino); +} + static struct file_system_type anon_inode_fs_type = { .name = "anon_inodefs", .get_sb = anon_inodefs_get_sb, @@ -52,6 +61,7 @@ static struct file_system_type anon_inod }; static const struct dentry_operations anon_inodefs_dentry_operations = { .d_delete = anon_inodefs_delete_dentry, + .d_dname = anon_inodefs_dname, }; /*