mtd/fs/jffs2 build.c,1.83,1.84

Artem Bityutskiy dedekind at infradead.org
Tue Sep 27 09:40:52 EDT 2005


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv11658

Modified Files:
	build.c 
Log Message:
[JFFS2] Use one memset() instead of many blah = 0/NULL.


Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- build.c	21 Sep 2005 15:52:33 -0000	1.83
+++ build.c	27 Sep 2005 13:40:49 -0000	1.84
@@ -309,28 +309,25 @@
 {
 	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);





More information about the linux-mtd-cvs mailing list