Re: [patch] epoll use a single inode ...

From: Davide Libenzi
Date: Tue Mar 06 2007 - 02:28:19 EST


On Tue, 6 Mar 2007, Avi Kivity wrote:

> > /* File callbacks that implement the eventpoll file behaviour */
> > static const struct file_operations eventpoll_fops = {
> > .release = ep_eventpoll_close,
> > @@ -763,15 +767,18 @@
> > * using the inode number.
> > */
> > error = -ENOMEM;
> > - sprintf(name, "[%lu]", inode->i_ino);
> > + sprintf(name, "[%p]", ep);
> > this.name = name;
> > this.len = strlen(name);
> > - this.hash = inode->i_ino;
> > + this.hash = 0;
> > dentry = d_alloc(eventpoll_mnt->mnt_sb->s_root, &this);
> > if (!dentry)
> > goto eexit_4;
> > dentry->d_op = &eventpollfs_dentry_operations;
> > - d_add(dentry, inode);
> > + /* Do not publish this dentry inside the global dentry hash table */
> > + dentry->d_flags &= ~DCACHE_UNHASHED;
> > + d_instantiate(dentry, inode);
> > +
> >
>
> I've used d_alloc_anon() in similar code in kvmfs. You lose the ep
> pointer in the name, but as a kernel address it isn't particularly
> useful to userspace.

That ends up calling two times the find alias for an unhashed dentry, no?
And this linearly scans the inode's dentry list, no?



- Davide


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/