Skip to contentSkip to conversation

fix for small jffs2 disks(resend)

PATCH Øyvind Harboe 1 participant 1 message May 6, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

With this patch, it is possible to write to small (e.g. single sector) flash disks.

Single sector flash disks are useful for writing configuration data that never change, e.g. in embedded devices for serial numbers, hardware configuration, feature selection and the like.

It has been applied to the eCos repository. To read more:

http://ecos.sourceware.org/ml/ecos-patches/2004-04/msg00043.html

Signature · 2 lines
Øyvind Harboe
http://www.zylin.com

? smalljffs2.txt
Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.55

build.c +8 -0
diff -w -u -r1.55 build.c
@@ -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;