aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2007-10-16 18:38:25 -0400
committerTheodore Ts'o <tytso@mit.edu>2007-10-17 18:49:57 -0400
commitd802ffa8850f2a80d141457d7221809182ed8c9f (patch)
treee5a3e9974f0242658ae41391990a28178cc42495 /fs
parent2d917969bc8dbde45900f5cbc2558e2cf1f8ec32 (diff)
JBD2/Ext4: Convert kmalloc to kzalloc in jbd2/ext4
Convert kmalloc to kzalloc() and get rid of the memset(). Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/xattr.c3
-rw-r--r--fs/jbd2/journal.c3
-rw-r--r--fs/jbd2/transaction.c3
3 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index b10d68fffb55..12c7d65fb0ca 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -750,12 +750,11 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
750 } 750 }
751 } else { 751 } else {
752 /* Allocate a buffer where we construct the new block. */ 752 /* Allocate a buffer where we construct the new block. */
753 s->base = kmalloc(sb->s_blocksize, GFP_KERNEL); 753 s->base = kzalloc(sb->s_blocksize, GFP_KERNEL);
754 /* assert(header == s->base) */ 754 /* assert(header == s->base) */
755 error = -ENOMEM; 755 error = -ENOMEM;
756 if (s->base == NULL) 756 if (s->base == NULL)
757 goto cleanup; 757 goto cleanup;
758 memset(s->base, 0, sb->s_blocksize);
759 header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); 758 header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
760 header(s->base)->h_blocks = cpu_to_le32(1); 759 header(s->base)->h_blocks = cpu_to_le32(1);
761 header(s->base)->h_refcount = cpu_to_le32(1); 760 header(s->base)->h_refcount = cpu_to_le32(1);
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 0e329a31c912..f12c65b81456 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -654,10 +654,9 @@ static journal_t * journal_init_common (void)
654 journal_t *journal; 654 journal_t *journal;
655 int err; 655 int err;
656 656
657 journal = kmalloc(sizeof(*journal), GFP_KERNEL); 657 journal = kzalloc(sizeof(*journal), GFP_KERNEL|__GFP_NOFAIL);
658 if (!journal) 658 if (!journal)
659 goto fail; 659 goto fail;
660 memset(journal, 0, sizeof(*journal));
661 660
662 init_waitqueue_head(&journal->j_wait_transaction_locked); 661 init_waitqueue_head(&journal->j_wait_transaction_locked);
663 init_waitqueue_head(&journal->j_wait_logspace); 662 init_waitqueue_head(&journal->j_wait_logspace);
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index a5fb70fb5621..b1fcf2b3dca3 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -96,13 +96,12 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
96 96
97alloc_transaction: 97alloc_transaction:
98 if (!journal->j_running_transaction) { 98 if (!journal->j_running_transaction) {
99 new_transaction = kmalloc(sizeof(*new_transaction), 99 new_transaction = kzalloc(sizeof(*new_transaction),
100 GFP_NOFS|__GFP_NOFAIL); 100 GFP_NOFS|__GFP_NOFAIL);
101 if (!new_transaction) { 101 if (!new_transaction) {
102 ret = -ENOMEM; 102 ret = -ENOMEM;
103 goto out; 103 goto out;
104 } 104 }
105 memset(new_transaction, 0, sizeof(*new_transaction));
106 } 105 }
107 106
108 jbd_debug(3, "New handle %p going live.\n", handle); 107 jbd_debug(3, "New handle %p going live.\n", handle);