]> Pileus Git - ~andy/linux/commitdiff
jbd2: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 19 Apr 2013 21:49:23 +0000 (17:49 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 19 Apr 2013 21:49:23 +0000 (17:49 -0400)
The jbd2_alloc_handle() function is only called by new_handle().  So
this commit uses kmem_cache_zalloc() instead of
kmem_cache_alloc()/memset().

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/jbd2/transaction.c
include/linux/jbd2.h

index 325bc019ed8813ea00321594405e86c739dad5fb..a1920da22802d4f5a758e61fce58df657e1d01ed 100644 (file)
@@ -332,7 +332,6 @@ static handle_t *new_handle(int nblocks)
        handle_t *handle = jbd2_alloc_handle(GFP_NOFS);
        if (!handle)
                return NULL;
-       memset(handle, 0, sizeof(*handle));
        handle->h_buffer_credits = nblocks;
        handle->h_ref = 1;
 
index f9fe88957b7a9e09276ac0dacbf99c912027ac99..6e051f472edb6db62f7e292b71c3bc5b2c5575f5 100644 (file)
@@ -1145,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache;
 
 static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags)
 {
-       return kmem_cache_alloc(jbd2_handle_cache, gfp_flags);
+       return kmem_cache_zalloc(jbd2_handle_cache, gfp_flags);
 }
 
 static inline void jbd2_free_handle(handle_t *handle)