1 Index: linux-2.6/fs/dcache.c
2 ===================================================================
3 --- linux-2.6.orig/fs/dcache.c 2006-08-31 11:59:09.000000000 +0800
4 +++ linux-2.6/fs/dcache.c 2006-09-06 14:01:37.000000000 +0800
5 @@ -226,6 +226,13 @@ int d_invalidate(struct dentry * dentry)
6 spin_unlock(&dcache_lock);
10 + /* network invalidation by Lustre */
11 + if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
12 + spin_unlock(&dcache_lock);
17 * Check whether to do a partial shrink_dcache
18 * to get rid of unused child entries.
19 @@ -1242,17 +1249,26 @@ static void __d_rehash(struct dentry * e
20 * Adds a dentry to the hash according to its name.
23 -void d_rehash(struct dentry * entry)
24 +void d_rehash_cond(struct dentry * entry, int lock)
26 struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
28 - spin_lock(&dcache_lock);
30 + spin_lock(&dcache_lock);
31 spin_lock(&entry->d_lock);
32 __d_rehash(entry, list);
33 spin_unlock(&entry->d_lock);
34 - spin_unlock(&dcache_lock);
36 + spin_unlock(&dcache_lock);
39 +EXPORT_SYMBOL(d_rehash_cond);
41 +void d_rehash(struct dentry * entry)
43 + d_rehash_cond(entry, 1);
46 #define do_switch(x,y) do { \
47 __typeof__ (x) __tmp = x; \
48 x = y; y = __tmp; } while (0)
49 Index: linux-2.6/include/linux/dcache.h
50 ===================================================================
51 --- linux-2.6.orig/include/linux/dcache.h 2006-08-31 12:00:23.000000000 +0800
52 +++ linux-2.6/include/linux/dcache.h 2006-09-06 14:02:36.000000000 +0800
53 @@ -176,6 +176,7 @@ d_iput: no no no yes
55 #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
56 #define DCACHE_UNHASHED 0x0010
57 +#define DCACHE_LUSTRE_INVALID 0x0040 /* Lustre invalidated */
59 #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
61 @@ -254,6 +255,7 @@ extern int have_submounts(struct dentry
62 * This adds the entry to the hash queues.
64 extern void d_rehash(struct dentry *);
65 +extern void d_rehash_cond(struct dentry *, int lock);
68 * d_add - add dentry to hash queues