Index: linux-2.6.18-rc4/fs/dcache.c =================================================================== --- linux-2.6.18-rc4.orig/fs/dcache.c 2006-08-06 11:20:11.000000000 -0700 +++ linux-2.6.18-rc4/fs/dcache.c 2006-08-10 18:49:12.613414256 -0700 @@ -32,7 +32,7 @@ #include #include #include - +#include int sysctl_vfs_cache_pressure __read_mostly = 100; EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); @@ -42,7 +42,7 @@ static __cacheline_aligned_in_smp DEFINE EXPORT_SYMBOL(dcache_lock); -static kmem_cache_t *dentry_cache __read_mostly; +static struct slab dentry_cache; #define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname)) @@ -73,7 +73,7 @@ static void d_callback(struct rcu_head * if (dname_external(dentry)) kfree(dentry->d_name.name); - kmem_cache_free(dentry_cache, dentry); + slab_free(&dentry_cache, dentry); } /* @@ -722,14 +722,14 @@ struct dentry *d_alloc(struct dentry * p struct dentry *dentry; char *dname; - dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); + dentry = slab_alloc(&dentry_cache, GFP_KERNEL); if (!dentry) return NULL; if (name->len > DNAME_INLINE_LEN-1) { dname = kmalloc(name->len + 1, GFP_KERNEL); if (!dname) { - kmem_cache_free(dentry_cache, dentry); + slab_free(&dentry_cache, dentry); return NULL; } } else { @@ -1157,7 +1157,7 @@ int d_validate(struct dentry *dentry, st struct hlist_node *lhp; /* Check whether the ptr might be valid at all.. */ - if (!kmem_ptr_validate(dentry_cache, dentry)) + if (!slab_pointer_valid(&dentry_cache, dentry)) goto out; if (dentry->d_parent != dparent) @@ -1707,13 +1707,10 @@ static void __init dcache_init(unsigned * but it is probably not worth it because of the cache nature * of the dcache. */ - dentry_cache = kmem_cache_create("dentry_cache", - sizeof(struct dentry), - 0, - (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| - SLAB_MEM_SPREAD), - NULL, NULL); - + if (slab_create(&dentry_cache, ALIGN(sizeof(struct dentry), L1_CACHE_BYTES), + 2, &page_allocator)) + panic("Cannot create dentry cache.\n"); + set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory); /* Hash may have been set up in dcache_init_early */