aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-09-27 09:40:52 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 16:41:34 -0500
commitd55849aa4d219b734795862692cc6981af848357 (patch)
treeaeddad3ad93ff49b298df11f8ba5cb8930f4c05b /fs
parent2f0077e01822424c4f73aa838a063a5b0193d533 (diff)
[JFFS2] Use memset(struct) instead of nulling struct members one by one
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/build.c17
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);