aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd
diff options
context:
space:
mode:
authorZheng Liu <wenqing.lz@taobao.com>2013-04-29 05:08:51 -0400
committerJan Kara <jack@suse.cz>2013-04-29 08:34:05 -0400
commit8bb9da943a62f4ffaabba1ad745990260fbb39df (patch)
tree7920bb9d78e4d4a2dbcb1e297472935d1d8ecbae /fs/jbd
parente162b2f835eeda0d255bd463753b5eb823735205 (diff)
jbd: use kmem_cache_zalloc for allocating journal head
This commit tries to use kmem_cache_zalloc instead of kmem_cache_alloc/ memset when a new journal head is alloctated. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/jbd')
-rw-r--r--fs/jbd/journal.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 81880c6d6b5e..726a4432cbb1 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1856,7 +1856,7 @@ static struct journal_head *journal_alloc_journal_head(void)
1856#ifdef CONFIG_JBD_DEBUG 1856#ifdef CONFIG_JBD_DEBUG
1857 atomic_inc(&nr_journal_heads); 1857 atomic_inc(&nr_journal_heads);
1858#endif 1858#endif
1859 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); 1859 ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
1860 if (ret == NULL) { 1860 if (ret == NULL) {
1861 jbd_debug(1, "out of memory for journal_head\n"); 1861 jbd_debug(1, "out of memory for journal_head\n");
1862 printk_ratelimited(KERN_NOTICE "ENOMEM in %s, retrying.\n", 1862 printk_ratelimited(KERN_NOTICE "ENOMEM in %s, retrying.\n",
@@ -1864,7 +1864,7 @@ static struct journal_head *journal_alloc_journal_head(void)
1864 1864
1865 while (ret == NULL) { 1865 while (ret == NULL) {
1866 yield(); 1866 yield();
1867 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); 1867 ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
1868 } 1868 }
1869 } 1869 }
1870 return ret; 1870 return ret;
@@ -1926,10 +1926,8 @@ struct journal_head *journal_add_journal_head(struct buffer_head *bh)
1926 struct journal_head *new_jh = NULL; 1926 struct journal_head *new_jh = NULL;
1927 1927
1928repeat: 1928repeat:
1929 if (!buffer_jbd(bh)) { 1929 if (!buffer_jbd(bh))
1930 new_jh = journal_alloc_journal_head(); 1930 new_jh = journal_alloc_journal_head();
1931 memset(new_jh, 0, sizeof(*new_jh));
1932 }
1933 1931
1934 jbd_lock_bh_journal_head(bh); 1932 jbd_lock_bh_journal_head(bh);
1935 if (buffer_jbd(bh)) { 1933 if (buffer_jbd(bh)) {