diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/build.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index ac393b3d6ea3..af6d2ec01366 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: build.c,v 1.83 2005/09/21 15:52:33 dedekind Exp $ | 10 | * $Id: build.c,v 1.84 2005/09/27 13:40:49 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -309,28 +309,25 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) | |||
309 | { | 309 | { |
310 | int ret; | 310 | int ret; |
311 | int i; | 311 | int i; |
312 | int size; | ||
312 | 313 | ||
313 | c->free_size = c->flash_size; | 314 | c->free_size = c->flash_size; |
314 | c->nr_blocks = c->flash_size / c->sector_size; | 315 | c->nr_blocks = c->flash_size / c->sector_size; |
316 | size = sizeof(struct jffs2_eraseblock) * c->nr_blocks; | ||
315 | #ifndef __ECOS | 317 | #ifndef __ECOS |
316 | if (jffs2_blocks_use_vmalloc(c)) | 318 | if (jffs2_blocks_use_vmalloc(c)) |
317 | c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks); | 319 | c->blocks = vmalloc(size); |
318 | else | 320 | else |
319 | #endif | 321 | #endif |
320 | c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL); | 322 | c->blocks = kmalloc(size, GFP_KERNEL); |
321 | if (!c->blocks) | 323 | if (!c->blocks) |
322 | return -ENOMEM; | 324 | return -ENOMEM; |
325 | |||
326 | memset(c->blocks, 0, size); | ||
323 | for (i=0; i<c->nr_blocks; i++) { | 327 | for (i=0; i<c->nr_blocks; i++) { |
324 | INIT_LIST_HEAD(&c->blocks[i].list); | 328 | INIT_LIST_HEAD(&c->blocks[i].list); |
325 | c->blocks[i].offset = i * c->sector_size; | 329 | c->blocks[i].offset = i * c->sector_size; |
326 | c->blocks[i].free_size = c->sector_size; | 330 | c->blocks[i].free_size = c->sector_size; |
327 | c->blocks[i].dirty_size = 0; | ||
328 | c->blocks[i].wasted_size = 0; | ||
329 | c->blocks[i].unchecked_size = 0; | ||
330 | c->blocks[i].used_size = 0; | ||
331 | c->blocks[i].first_node = NULL; | ||
332 | c->blocks[i].last_node = NULL; | ||
333 | c->blocks[i].bad_count = 0; | ||
334 | } | 331 | } |
335 | 332 | ||
336 | INIT_LIST_HEAD(&c->clean_list); | 333 | INIT_LIST_HEAD(&c->clean_list); |