diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-08-25 22:36:25 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-08-25 22:36:25 -0400 |
commit | 1927805e6599d8602d2c0af6a0155c85acc0b214 (patch) | |
tree | b5549d33960ef312efc3b8f54c78268a3e4f74dd /fs/ext4/mballoc.c | |
parent | a8526e84ac758ac6da45cf273aa1538a6a7aa3de (diff) |
ext4: use variables not types in sizeofs() for allocations
Precursor to changing some types; to keep things in sync, it
seems better to allocate/memset based on the size of the
variables we are using rather than on some disconnected
basic type like "unsigned short"
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 1a9cd7de04dd..081eaf7fce89 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -868,7 +868,8 @@ static int ext4_mb_init_cache(struct page *page, char *incore) | |||
868 | grinfo = ext4_get_group_info(sb, group); | 868 | grinfo = ext4_get_group_info(sb, group); |
869 | grinfo->bb_fragments = 0; | 869 | grinfo->bb_fragments = 0; |
870 | memset(grinfo->bb_counters, 0, | 870 | memset(grinfo->bb_counters, 0, |
871 | sizeof(unsigned short)*(sb->s_blocksize_bits+2)); | 871 | sizeof(*grinfo->bb_counters) * |
872 | (sb->s_blocksize_bits+2)); | ||
872 | /* | 873 | /* |
873 | * incore got set to the group block bitmap below | 874 | * incore got set to the group block bitmap below |
874 | */ | 875 | */ |
@@ -2640,14 +2641,14 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) | |||
2640 | unsigned max; | 2641 | unsigned max; |
2641 | int ret; | 2642 | int ret; |
2642 | 2643 | ||
2643 | i = (sb->s_blocksize_bits + 2) * sizeof(unsigned short); | 2644 | i = (sb->s_blocksize_bits + 2) * sizeof(*sbi->s_mb_offsets); |
2644 | 2645 | ||
2645 | sbi->s_mb_offsets = kmalloc(i, GFP_KERNEL); | 2646 | sbi->s_mb_offsets = kmalloc(i, GFP_KERNEL); |
2646 | if (sbi->s_mb_offsets == NULL) { | 2647 | if (sbi->s_mb_offsets == NULL) { |
2647 | return -ENOMEM; | 2648 | return -ENOMEM; |
2648 | } | 2649 | } |
2649 | 2650 | ||
2650 | i = (sb->s_blocksize_bits + 2) * sizeof(unsigned int); | 2651 | i = (sb->s_blocksize_bits + 2) * sizeof(*sbi->s_mb_maxs); |
2651 | sbi->s_mb_maxs = kmalloc(i, GFP_KERNEL); | 2652 | sbi->s_mb_maxs = kmalloc(i, GFP_KERNEL); |
2652 | if (sbi->s_mb_maxs == NULL) { | 2653 | if (sbi->s_mb_maxs == NULL) { |
2653 | kfree(sbi->s_mb_offsets); | 2654 | kfree(sbi->s_mb_offsets); |