aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-05-06 17:49:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:55 -0400
commit0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64 (patch)
treea945e829bf6bf7a93bf844b2ee9f2a3a2fa17c5d /fs/dcache.c
parent5af60839909b8e3b28ca7cd7912fa0b23475617f (diff)
KMEM_CACHE(): simplify slab cache creation
This patch provides a new macro KMEM_CACHE(<struct>, <flags>) to simplify slab creation. KMEM_CACHE creates a slab with the name of the struct, with the size of the struct and with the alignment of the struct. Additional slab flags may be specified if necessary. Example struct test_slab { int a,b,c; struct list_head; } __cacheline_aligned_in_smp; test_slab_cache = KMEM_CACHE(test_slab, SLAB_PANIC) will create a new slab named "test_slab" of the size sizeof(struct test_slab) and aligned to the alignment of test slab. If it fails then we panic. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index d68631f18df1..d1bf5d8aeb5a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2052,12 +2052,8 @@ static void __init dcache_init(unsigned long mempages)
2052 * but it is probably not worth it because of the cache nature 2052 * but it is probably not worth it because of the cache nature
2053 * of the dcache. 2053 * of the dcache.
2054 */ 2054 */
2055 dentry_cache = kmem_cache_create("dentry_cache", 2055 dentry_cache = KMEM_CACHE(dentry,
2056 sizeof(struct dentry), 2056 SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
2057 0,
2058 (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
2059 SLAB_MEM_SPREAD),
2060 NULL, NULL);
2061 2057
2062 set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory); 2058 set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);
2063 2059