diff -urN tux-vfs-ref/fs/dcache.c tux-vfs/fs/dcache.c --- tux-vfs-ref/fs/dcache.c Tue Jan 22 02:15:14 2002 +++ tux-vfs/fs/dcache.c Tue Jan 22 02:15:40 2002 @@ -62,6 +62,10 @@ dentry->d_op->d_release(dentry); if (dname_external(dentry)) kfree(dentry->d_name.name); + if (dentry->d_extra_attributes) { + kfree(dentry->d_extra_attributes); + dentry->d_extra_attributes = NULL; + } kmem_cache_free(dentry_cache, dentry); dentry_stat.nr_dentry--; } @@ -617,6 +621,7 @@ dentry->d_name.hash = name->hash; dentry->d_op = NULL; dentry->d_fsdata = NULL; + dentry->d_extra_attributes = NULL; dentry->d_mounted = 0; INIT_LIST_HEAD(&dentry->d_hash); INIT_LIST_HEAD(&dentry->d_lru); @@ -912,6 +917,16 @@ /* Unhash the target: dput() will then get rid of it */ list_del_init(&target->d_hash); + /* flush any possible attribute */ + if (dentry->d_extra_attributes) { + kfree(dentry->d_extra_attributes); + dentry->d_extra_attributes = NULL; + } + if (target->d_extra_attributes) { + kfree(target->d_extra_attributes); + target->d_extra_attributes = NULL; + } + list_del(&dentry->d_child); list_del(&target->d_child); @@ -1163,6 +1178,26 @@ } out: return ino; +} + +void flush_dentry_attributes (void) +{ + struct list_head *chain, *tmp; + struct dentry *dentry; + int i; + + spin_lock(&dcache_lock); + for (i = 0; i <= d_hash_mask; i++) { + chain = dentry_hashtable + i; + tmp = chain->next; + while (tmp != chain) { + dentry = list_entry(tmp, struct dentry, d_hash); + kfree(dentry->d_extra_attributes); + dentry->d_extra_attributes = NULL; + tmp = tmp->next; + } + } + spin_unlock(&dcache_lock); } static void __init dcache_init(unsigned long mempages) diff -urN tux-vfs-ref/include/linux/dcache.h tux-vfs/include/linux/dcache.h --- tux-vfs-ref/include/linux/dcache.h Thu Nov 22 20:46:18 2001 +++ tux-vfs/include/linux/dcache.h Tue Jan 22 02:16:02 2002 @@ -80,6 +80,7 @@ struct super_block * d_sb; /* The root of the dentry tree */ unsigned long d_vfs_flags; void * d_fsdata; /* fs-specific data */ + void * d_extra_attributes; /* TUX-specific data */ unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ }; @@ -167,6 +168,7 @@ extern void shrink_dcache_sb(struct super_block *); extern void shrink_dcache_parent(struct dentry *); extern int d_invalidate(struct dentry *); +extern void flush_dentry_attributes(void); #define shrink_dcache() prune_dcache(0) struct zone_struct; diff -urN tux-vfs-ref/kernel/ksyms.c tux-vfs/kernel/ksyms.c --- tux-vfs-ref/kernel/ksyms.c Tue Jan 22 02:15:17 2002 +++ tux-vfs/kernel/ksyms.c Tue Jan 22 02:15:40 2002 @@ -239,6 +239,7 @@ EXPORT_SYMBOL(prune_dcache); EXPORT_SYMBOL(shrink_dcache_sb); EXPORT_SYMBOL(shrink_dcache_parent); +EXPORT_SYMBOL(flush_dentry_attributes); EXPORT_SYMBOL(find_inode_number); EXPORT_SYMBOL(is_subdir); EXPORT_SYMBOL(get_unused_fd);