diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-05-08 03:26:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:03 -0400 |
commit | c23fbb6bcb3eb9cdf39a103edadf57bde8ce309c (patch) | |
tree | d79ab2278774de2c1a8061aa948ed068902e87b4 /include/linux/dcache.h | |
parent | 2793274298c4423d79701e9a8190f2940bf3c785 (diff) |
VFS: delay the dentry name generation on sockets and pipes
1) Introduces a new method in 'struct dentry_operations'. This method
called d_dname() might be called from d_path() to build a pathname for
special filesystems. It is called without locks.
Future patches (if we succeed in having one common dentry for all
pipes/sockets) may need to change prototype of this method, but we now
use : char *d_dname(struct dentry *dentry, char *buffer, int buflen);
2) Adds a dynamic_dname() helper function that eases d_dname() implementations
3) Defines d_dname method for sockets : No more sprintf() at socket
creation. This is delayed up to the moment someone does an access to
/proc/pid/fd/...
4) Defines d_dname method for pipes : No more sprintf() at pipe
creation. This is delayed up to the moment someone does an access to
/proc/pid/fd/...
A benchmark consisting of 1.000.000 calls to pipe()/close()/close() gives a
*nice* speedup on my Pentium(M) 1.6 Ghz :
3.090 s instead of 3.450 s
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 63f64a9a5bf7..aab53df4fafa 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -133,6 +133,7 @@ struct dentry_operations { | |||
133 | int (*d_delete)(struct dentry *); | 133 | int (*d_delete)(struct dentry *); |
134 | void (*d_release)(struct dentry *); | 134 | void (*d_release)(struct dentry *); |
135 | void (*d_iput)(struct dentry *, struct inode *); | 135 | void (*d_iput)(struct dentry *, struct inode *); |
136 | char *(*d_dname)(struct dentry *, char *, int); | ||
136 | }; | 137 | }; |
137 | 138 | ||
138 | /* the dentry parameter passed to d_hash and d_compare is the parent | 139 | /* the dentry parameter passed to d_hash and d_compare is the parent |
@@ -293,6 +294,11 @@ extern struct dentry * d_hash_and_lookup(struct dentry *, struct qstr *); | |||
293 | /* validate "insecure" dentry pointer */ | 294 | /* validate "insecure" dentry pointer */ |
294 | extern int d_validate(struct dentry *, struct dentry *); | 295 | extern int d_validate(struct dentry *, struct dentry *); |
295 | 296 | ||
297 | /* | ||
298 | * helper function for dentry_operations.d_dname() members | ||
299 | */ | ||
300 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | ||
301 | |||
296 | extern char * d_path(struct dentry *, struct vfsmount *, char *, int); | 302 | extern char * d_path(struct dentry *, struct vfsmount *, char *, int); |
297 | 303 | ||
298 | /* Allocation counts.. */ | 304 | /* Allocation counts.. */ |