jffs2 fix for small flash disks

Øyvind Harboe oyvind.harboe@zylin.com
Mon Apr 19 13:13:00 GMT 2004


-- 

Øyvind Harboe
http://www.zylin.com


-------------- next part --------------
? config.txt
? current/src/ll.txt
Index: current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/ChangeLog,v
retrieving revision 1.32
diff -a -u -w -r1.32 ChangeLog
--- current/ChangeLog	6 Apr 2004 19:40:35 -0000	1.32
+++ current/ChangeLog	19 Apr 2004 13:11:54 -0000
@@ -1,3 +1,8 @@
+2004-04-19  Oyvind Harboe <oyvind.harboe@zylin.com>
+	
+	* src/build.c: JFFS2 can now be used as a write-once, read many mode
+	for really small flash disks, e.g. configuration parameters.
+	
 2004-04-06  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/fs-ecos.c (jffs2_extend_file): Fix creation of hole inode's
Index: current/src/build.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/build.c,v
retrieving revision 1.5
diff -a -u -w -r1.5 build.c
--- current/src/build.c	20 Nov 2003 16:52:36 -0000	1.5
+++ current/src/build.c	19 Apr 2004 13:11:54 -0000
@@ -259,6 +259,14 @@
 
 	c->resv_blocks_write = c->resv_blocks_deletion + (size / c->sector_size);
 
+	// If the flash disk is smaller than resv_blocks_write, then we 
+	// allow writing to the disk anyway. The flash disk is then most likely
+	// being used as write once - read many medimum, e.g. configuration of 
+	// static paramters.
+	if (c->resv_blocks_write * c->sector_size > c->flash_size) {
+	  c->resv_blocks_write = 0; 
+	}
+
 	/* When do we let the GC thread run in the background */
 
 	c->resv_blocks_gctrigger = c->resv_blocks_write + 1;


More information about the Ecos-patches mailing list