jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 12 Apr 2013 02:24:06 +0000 (02:24 +0000)
committerJan Kara <jack@suse.cz>
Thu, 25 Apr 2013 13:25:23 +0000 (15:25 +0200)
Now jbd_alloc_handle 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: Jan Kara <jack@suse.cz>
fs/jbd/transaction.c
include/linux/jbd.h

index 071d6905f0dd92c57dc2a8e6a5e62f81993ca5e8..e3e255c0a50968cd41efe9f9b9706290875f47fd 100644 (file)
@@ -245,7 +245,6 @@ static handle_t *new_handle(int nblocks)
        handle_t *handle = jbd_alloc_handle(GFP_NOFS);
        if (!handle)
                return NULL;
-       memset(handle, 0, sizeof(*handle));
        handle->h_buffer_credits = nblocks;
        handle->h_ref = 1;
 
index c8f32975f0e41699164c772701a183184379ba32..7e0b622503c4ae90300c0e9281a7c02cc55ac9a4 100644 (file)
@@ -887,7 +887,7 @@ extern struct kmem_cache *jbd_handle_cache;
 
 static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
 {
-       return kmem_cache_alloc(jbd_handle_cache, gfp_flags);
+       return kmem_cache_zalloc(jbd_handle_cache, gfp_flags);
 }
 
 static inline void jbd_free_handle(handle_t *handle)