Commit 01afb213 authored by Yan Burman's avatar Yan Burman Committed by Linus Torvalds

[PATCH] reiser: replace kmalloc+memset with kzalloc

Replace kmalloc+memset with kzalloc
Signed-off-by: default avatarYan Burman <burman.yan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9399575d
...@@ -317,12 +317,11 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl ...@@ -317,12 +317,11 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl
/* area filled with zeroes, to supply as list of zero blocknumbers /* area filled with zeroes, to supply as list of zero blocknumbers
We allocate it outside of loop just in case loop would spin for We allocate it outside of loop just in case loop would spin for
several iterations. */ several iterations. */
char *zeros = kmalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway. char *zeros = kzalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway.
if (!zeros) { if (!zeros) {
res = -ENOMEM; res = -ENOMEM;
goto error_exit_free_blocks; goto error_exit_free_blocks;
} }
memset(zeros, 0, to_paste * UNFM_P_SIZE);
do { do {
to_paste = to_paste =
min_t(__u64, hole_size, min_t(__u64, hole_size,
......
...@@ -929,15 +929,12 @@ int reiserfs_get_block(struct inode *inode, sector_t block, ...@@ -929,15 +929,12 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
if (blocks_needed == 1) { if (blocks_needed == 1) {
un = &unf_single; un = &unf_single;
} else { } else {
un = kmalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling. un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling.
if (!un) { if (!un) {
un = &unf_single; un = &unf_single;
blocks_needed = 1; blocks_needed = 1;
max_to_insert = 0; max_to_insert = 0;
} else }
memset(un, 0,
UNFM_P_SIZE * min(blocks_needed,
max_to_insert));
} }
if (blocks_needed <= max_to_insert) { if (blocks_needed <= max_to_insert) {
/* we are going to add target block to the file. Use allocated /* we are going to add target block to the file. Use allocated
......
...@@ -1549,13 +1549,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1549,13 +1549,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
struct reiserfs_sb_info *sbi; struct reiserfs_sb_info *sbi;
int errval = -EINVAL; int errval = -EINVAL;
sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
if (!sbi) { if (!sbi) {
errval = -ENOMEM; errval = -ENOMEM;
goto error; goto error;
} }
s->s_fs_info = sbi; s->s_fs_info = sbi;
memset(sbi, 0, sizeof(struct reiserfs_sb_info));
/* Set default values for options: non-aggressive tails, RO on errors */ /* Set default values for options: non-aggressive tails, RO on errors */
REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);
REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO); REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);
......
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