diff options
author | Joe Perches <joe@perches.com> | 2011-05-28 13:36:33 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 07:56:28 -0400 |
commit | 558feb0818374d657fbc1ea03776ee20f204b3a6 (patch) | |
tree | 9c063b50ef953405850422ca740dda3093ef6387 /fs/reiserfs | |
parent | 1ac4594d88f63ba1557cc1a30ec1f915ca55b7cb (diff) |
fs: Convert vmalloc/memset to vzalloc
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/journal.c | 9 | ||||
-rw-r--r-- | fs/reiserfs/resize.c | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index a159ba5a35e7..eb711060a6f2 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -291,14 +291,13 @@ int reiserfs_allocate_list_bitmaps(struct super_block *sb, | |||
291 | for (i = 0; i < JOURNAL_NUM_BITMAPS; i++) { | 291 | for (i = 0; i < JOURNAL_NUM_BITMAPS; i++) { |
292 | jb = jb_array + i; | 292 | jb = jb_array + i; |
293 | jb->journal_list = NULL; | 293 | jb->journal_list = NULL; |
294 | jb->bitmaps = vmalloc(mem); | 294 | jb->bitmaps = vzalloc(mem); |
295 | if (!jb->bitmaps) { | 295 | if (!jb->bitmaps) { |
296 | reiserfs_warning(sb, "clm-2000", "unable to " | 296 | reiserfs_warning(sb, "clm-2000", "unable to " |
297 | "allocate bitmaps for journal lists"); | 297 | "allocate bitmaps for journal lists"); |
298 | failed = 1; | 298 | failed = 1; |
299 | break; | 299 | break; |
300 | } | 300 | } |
301 | memset(jb->bitmaps, 0, mem); | ||
302 | } | 301 | } |
303 | if (failed) { | 302 | if (failed) { |
304 | free_list_bitmaps(sb, jb_array); | 303 | free_list_bitmaps(sb, jb_array); |
@@ -353,11 +352,10 @@ static struct reiserfs_journal_cnode *allocate_cnodes(int num_cnodes) | |||
353 | if (num_cnodes <= 0) { | 352 | if (num_cnodes <= 0) { |
354 | return NULL; | 353 | return NULL; |
355 | } | 354 | } |
356 | head = vmalloc(num_cnodes * sizeof(struct reiserfs_journal_cnode)); | 355 | head = vzalloc(num_cnodes * sizeof(struct reiserfs_journal_cnode)); |
357 | if (!head) { | 356 | if (!head) { |
358 | return NULL; | 357 | return NULL; |
359 | } | 358 | } |
360 | memset(head, 0, num_cnodes * sizeof(struct reiserfs_journal_cnode)); | ||
361 | head[0].prev = NULL; | 359 | head[0].prev = NULL; |
362 | head[0].next = head + 1; | 360 | head[0].next = head + 1; |
363 | for (i = 1; i < num_cnodes; i++) { | 361 | for (i = 1; i < num_cnodes; i++) { |
@@ -2685,14 +2683,13 @@ int journal_init(struct super_block *sb, const char *j_dev_name, | |||
2685 | * dependency inversion warnings. | 2683 | * dependency inversion warnings. |
2686 | */ | 2684 | */ |
2687 | reiserfs_write_unlock(sb); | 2685 | reiserfs_write_unlock(sb); |
2688 | journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal)); | 2686 | journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal)); |
2689 | if (!journal) { | 2687 | if (!journal) { |
2690 | reiserfs_warning(sb, "journal-1256", | 2688 | reiserfs_warning(sb, "journal-1256", |
2691 | "unable to get memory for journal structure"); | 2689 | "unable to get memory for journal structure"); |
2692 | reiserfs_write_lock(sb); | 2690 | reiserfs_write_lock(sb); |
2693 | return 1; | 2691 | return 1; |
2694 | } | 2692 | } |
2695 | memset(journal, 0, sizeof(struct reiserfs_journal)); | ||
2696 | INIT_LIST_HEAD(&journal->j_bitmap_nodes); | 2693 | INIT_LIST_HEAD(&journal->j_bitmap_nodes); |
2697 | INIT_LIST_HEAD(&journal->j_prealloc_list); | 2694 | INIT_LIST_HEAD(&journal->j_prealloc_list); |
2698 | INIT_LIST_HEAD(&journal->j_working_list); | 2695 | INIT_LIST_HEAD(&journal->j_working_list); |
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c index b6b9b1fe33b0..7483279b482d 100644 --- a/fs/reiserfs/resize.c +++ b/fs/reiserfs/resize.c | |||
@@ -111,15 +111,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
111 | /* allocate additional bitmap blocks, reallocate array of bitmap | 111 | /* allocate additional bitmap blocks, reallocate array of bitmap |
112 | * block pointers */ | 112 | * block pointers */ |
113 | bitmap = | 113 | bitmap = |
114 | vmalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new); | 114 | vzalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new); |
115 | if (!bitmap) { | 115 | if (!bitmap) { |
116 | /* Journal bitmaps are still supersized, but the memory isn't | 116 | /* Journal bitmaps are still supersized, but the memory isn't |
117 | * leaked, so I guess it's ok */ | 117 | * leaked, so I guess it's ok */ |
118 | printk("reiserfs_resize: unable to allocate memory.\n"); | 118 | printk("reiserfs_resize: unable to allocate memory.\n"); |
119 | return -ENOMEM; | 119 | return -ENOMEM; |
120 | } | 120 | } |
121 | memset(bitmap, 0, | ||
122 | sizeof(struct reiserfs_bitmap_info) * bmap_nr_new); | ||
123 | for (i = 0; i < bmap_nr; i++) | 121 | for (i = 0; i < bmap_nr; i++) |
124 | bitmap[i] = old_bitmap[i]; | 122 | bitmap[i] = old_bitmap[i]; |
125 | 123 | ||