Skip to contentSkip to conversation

epoll use a single inode ...

PATCH Davide Libenzi 1 participant 1 message Mar 6, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 19 lines · Avi Kivity
Quoted 19 lines

/* File callbacks that implement the eventpoll file behaviour */ static const struct file_operations eventpoll_fops = {

(quoted diff) +3 -3
 	.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 */
Quoted 8 lines

Review line 782

Quoted 4 lines
(quoted diff) +3 -0
+	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