* [PATCH] jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
@ 2013-04-12 12:24 Zheng Liu
2013-04-25 10:12 ` Zheng Liu
0 siblings, 1 reply; 3+ messages in thread
From: Zheng Liu @ 2013-04-12 12:24 UTC (permalink / raw)
To: linux-ext4; +Cc: Zheng Liu
From: Zheng Liu <wenqing.lz@taobao.com>
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>
---
fs/jbd/transaction.c | 1 -
include/linux/jbd.h | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 071d690..e3e255c 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -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;
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c8f3297..7e0b622 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -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)
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
2013-04-12 12:24 [PATCH] jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Zheng Liu
@ 2013-04-25 10:12 ` Zheng Liu
2013-04-25 13:27 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Zheng Liu @ 2013-04-25 10:12 UTC (permalink / raw)
To: linux-ext4, Jan Kara; +Cc: Zheng Liu
On Fri, Apr 12, 2013 at 08:24:06PM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> 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>
Hi Jan,
Sorry, I forgot to Cc you. Could you please take a look at this patch?
Thanks,
- Zheng
> ---
> fs/jbd/transaction.c | 1 -
> include/linux/jbd.h | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
> index 071d690..e3e255c 100644
> --- a/fs/jbd/transaction.c
> +++ b/fs/jbd/transaction.c
> @@ -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;
>
> diff --git a/include/linux/jbd.h b/include/linux/jbd.h
> index c8f3297..7e0b622 100644
> --- a/include/linux/jbd.h
> +++ b/include/linux/jbd.h
> @@ -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)
> --
> 1.7.12.rc2.18.g61b472e
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
2013-04-25 10:12 ` Zheng Liu
@ 2013-04-25 13:27 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2013-04-25 13:27 UTC (permalink / raw)
To: Zheng Liu; +Cc: linux-ext4, Jan Kara, Zheng Liu
On Thu 25-04-13 18:12:49, Zheng Liu wrote:
> On Fri, Apr 12, 2013 at 08:24:06PM +0800, Zheng Liu wrote:
> > From: Zheng Liu <wenqing.lz@taobao.com>
> >
> > 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>
>
> Hi Jan,
>
> Sorry, I forgot to Cc you. Could you please take a look at this patch?
Yeah, I must have missed it somehow. The patch looks fine, thanks. I've
added it to my tree.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-25 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12 12:24 [PATCH] jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Zheng Liu
2013-04-25 10:12 ` Zheng Liu
2013-04-25 13:27 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox