Commit 28daf4fa authored by Zheng Liu's avatar Zheng Liu Committed by Theodore Ts'o

jbd2: use kmem_cache_zalloc instead of kmem_cache_alloc/memset

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: default avatarZheng Liu <wenqing.lz@taobao.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 2656497b
...@@ -332,7 +332,6 @@ static handle_t *new_handle(int nblocks) ...@@ -332,7 +332,6 @@ static handle_t *new_handle(int nblocks)
handle_t *handle = jbd2_alloc_handle(GFP_NOFS); handle_t *handle = jbd2_alloc_handle(GFP_NOFS);
if (!handle) if (!handle)
return NULL; return NULL;
memset(handle, 0, sizeof(*handle));
handle->h_buffer_credits = nblocks; handle->h_buffer_credits = nblocks;
handle->h_ref = 1; handle->h_ref = 1;
......
...@@ -1145,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache; ...@@ -1145,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache;
static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags) 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) static inline void jbd2_free_handle(handle_t *handle)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment