diff options
-rw-r--r-- | fs/coda/coda_linux.h | 5 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 9 | ||||
-rw-r--r-- | fs/reiserfs/resize.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 7 |
4 files changed, 7 insertions, 18 deletions
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h index 44e17e9c21ae..cc0ea9fe5ecf 100644 --- a/fs/coda/coda_linux.h +++ b/fs/coda/coda_linux.h | |||
@@ -59,12 +59,11 @@ void coda_sysctl_clean(void); | |||
59 | 59 | ||
60 | #define CODA_ALLOC(ptr, cast, size) do { \ | 60 | #define CODA_ALLOC(ptr, cast, size) do { \ |
61 | if (size < PAGE_SIZE) \ | 61 | if (size < PAGE_SIZE) \ |
62 | ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ | 62 | ptr = kzalloc((unsigned long) size, GFP_KERNEL); \ |
63 | else \ | 63 | else \ |
64 | ptr = (cast)vmalloc((unsigned long) size); \ | 64 | ptr = (cast)vzalloc((unsigned long) size); \ |
65 | if (!ptr) \ | 65 | if (!ptr) \ |
66 | printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ | 66 | printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ |
67 | else memset( ptr, 0, size ); \ | ||
68 | } while (0) | 67 | } while (0) |
69 | 68 | ||
70 | 69 | ||
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 | ||
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index f7c8f7a9ea6d..292eff198030 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -61,12 +61,7 @@ extern void kmem_free(const void *); | |||
61 | 61 | ||
62 | static inline void *kmem_zalloc_large(size_t size) | 62 | static inline void *kmem_zalloc_large(size_t size) |
63 | { | 63 | { |
64 | void *ptr; | 64 | return vzalloc(size); |
65 | |||
66 | ptr = vmalloc(size); | ||
67 | if (ptr) | ||
68 | memset(ptr, 0, size); | ||
69 | return ptr; | ||
70 | } | 65 | } |
71 | static inline void kmem_free_large(void *ptr) | 66 | static inline void kmem_free_large(void *ptr) |
72 | { | 67 | { |