PATCH: allow JFFS2 to write to really small disks

Jörn Engel joern at wohnheim.fh-wedel.de
Thu Sep 1 06:05:35 EDT 2005


On Wed, 31 August 2005 11:28:12 +0200, Øyvind Harboe wrote:
> 
> The attached patch allows JFFS2 to write to really small JFFS2 disks.
> 
> This is e.g. useful when using JFFS2 for in-system one time programming
> of embedded device parameters: serial number, MAC, etc.
> 
> Comments?

> Index: build.c
> ===================================================================
> RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
> retrieving revision 1.76
> diff -u -r1.76 build.c
> --- build.c    30 Jul 2005 15:29:27 -0000	1.76
> +++ build.c    31 Aug 2005 09:01:34 -0000
> @@ -279,6 +279,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. in-system configuration of 
> +	         static parameters(e.g. MAC address of device in stored in "ROM"). */
> +		 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;

Minor stuff: You indentation is broken.

If you changed the patch to add a mount option for the WORM case and
check for the mount option instead, this might go in.  Looks like it
could be useful.

Jörn

-- 
Courage is not the absence of fear, but rather the judgement that
something else is more important than fear.
-- Ambrose Redmoon




More information about the linux-mtd mailing list