[PATCH 2/2] jbd: use KMEM_CACHE instead of kmem_cache_create

Yongqiang Yang
2011-11-13T13:52:28Z

Let jbd use KMEM_CACHE instead of kmem_cache_create.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
fs/jbd/journal.c | 12 ++----------
fs/jbd/revoke.c | 11 +++--------
2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 45ca982..b0ee518 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1735,11 +1735,7 @@ static int journal_init_journal_head_cache(void)
int retval;

J_ASSERT(journal_head_cache == NULL);
- journal_head_cache = kmem_cache_create("journal_head",
- sizeof(struct journal_head),
- 0, /* offset */
- SLAB_TEMPORARY, /* flags */
- NULL); /* ctor */
+ journal_head_cache = KMEM_CACHE(journal_head, SLAB_TEMPORARY);
retval = 0;
if (!journal_head_cache) {
retval = -ENOMEM;
@@ -1973,11 +1969,7 @@ struct kmem_cache *jbd_handle_cache;

static int __init journal_init_handle_cache(void)
{
- jbd_handle_cache = kmem_cache_create("journal_handle",
- sizeof(handle_t),
- 0, /* offset */
- SLAB_TEMPORARY, /* flags */
- NULL); /* ctor */
+ jbd_handle_cache = KMEM_CACHE(handle_s, SLAB_TEMPORARY);
if (jbd_handle_cache == NULL) {
printk(KERN_EMERG "JBD: failed to create handle cache\n");
return -ENOMEM;
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c
index 305a907..034eb82 100644
--- a/fs/jbd/revoke.c
+++ b/fs/jbd/revoke.c
@@ -203,17 +203,12 @@ int __init journal_init_revoke_caches(void)
J_ASSERT(!revoke_record_cache);
J_ASSERT(!revoke_table_cache);

- revoke_record_cache = kmem_cache_create("revoke_record",
- sizeof(struct jbd_revoke_record_s),
- 0,
- SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
- NULL);
+ revoke_record_cache = KMEM_CACHE(jbd_revoke_record_s,
+ SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
if (!revoke_record_cache)
goto record_cache_failure;

- revoke_table_cache = kmem_cache_create("revoke_table",
- sizeof(struct jbd_revoke_table_s),
- 0, SLAB_TEMPORARY, NULL);
+ revoke_table_cache = KMEM_CACHE(jbd_revoke_table_s, SLAB_TEMPORARY);
if (!revoke_table_cache)
goto table_cache_failure;

--
1.7.5.1