aboutsummaryrefslogtreecommitdiff
path: root/fs/jffs2
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-09-27 14:40:52 +0100
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 22:41:34 +0100
commitd55849aa4d219b734795862692cc6981af848357 (patch)
treeaeddad3ad93ff49b298df11f8ba5cb8930f4c05b /fs/jffs2
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/jffs2')
-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 ac393b3d6ea..af6d2ec0136 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: build.c,v 1.83 2005/09/21 15:52:33 dedekind Exp $
+ * $Id: build.c,v 1.84 2005/09/27 13:40:49 dedekind Exp $
*
*/
@@ -309,28 +309,25 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
{
int ret;
int i;
+ int size;
c->free_size = c->flash_size;
c->nr_blocks = c->flash_size / c->sector_size;
+ size = sizeof(struct jffs2_eraseblock) * c->nr_blocks;
#ifndef __ECOS
if (jffs2_blocks_use_vmalloc(c))
- c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks);
+ c->blocks = vmalloc(size);
else
#endif
- c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL);
+ c->blocks = kmalloc(size, GFP_KERNEL);
if (!c->blocks)
return -ENOMEM;
+
+ memset(c->blocks, 0, size);
for (i=0; i<c->nr_blocks; i++) {
INIT_LIST_HEAD(&c->blocks[i].list);
c->blocks[i].offset = i * c->sector_size;
c->blocks[i].free_size = c->sector_size;
- c->blocks[i].dirty_size = 0;
- c->blocks[i].wasted_size = 0;
- c->blocks[i].unchecked_size = 0;
- c->blocks[i].used_size = 0;
- c->blocks[i].first_node = NULL;
- c->blocks[i].last_node = NULL;
- c->blocks[i].bad_count = 0;
}
INIT_LIST_HEAD(&c->clean_list);