lkml.org 
[lkml]   [2008]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: pipe/sockets/anon dentries should have themselves as parent
On Fri, Nov 21, 2008 at 06:58:29PM +0100, Eric Dumazet wrote:
> +/**
> + * d_alloc_unhashed - allocate unhashed dentry
> + * @inode: inode to allocate the dentry for
> + * @name: dentry name

It's normal to list the parameters in the order they're passed to the
function. Not sure if we have a tool that checks for this or not --
Randy?

> + *
> + * Allocate an unhashed dentry for the inode given. The inode is
> + * instantiated and returned. %NULL is returned if there is insufficient
> + * memory. Unhashed dentries have themselves as a parent.
> + */
> +
> +struct dentry * d_alloc_unhashed(const char *name, struct inode *inode)
> +{
> + struct qstr q = { .name = name, .len = strlen(name) };
> + struct dentry *res;
> +
> + res = d_alloc(NULL, &q);
> + if (res) {
> + res->d_sb = inode->i_sb;
> + res->d_parent = res;
> + /*
> + * We dont want to push this dentry into global dentry hash table.
> + * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED
> + * This permits a working /proc/$pid/fd/XXX on sockets,pipes,anon
> + */

Line length ... as checkpatch would have warned you ;-)

And there are several other grammatical nitpicks with this comment. Try
this:

/*
* We don't want to put this dentry in the global dentry
* hash table, so we pretend the dentry is already hashed
* by unsetting DCACHE_UNHASHED. This permits
* /proc/$pid/fd/XXX t work for sockets, pipes and
* anonymous files (signalfd, timerfd, etc).
*/

> + res->d_flags &= ~DCACHE_UNHASHED;
> + res->d_flags |= DCACHE_DISCONNECTED;

Is this really better than:

res->d_flags = res->d_flags & ~DCACHE_UNHASHED |
DCACHE_DISCONNECTED;

Anyway, nice cleanup.

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."


\
 
 \ /
  Last update: 2008-11-21 19:47    [W:0.112 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site