JFFS2 force erase.

Agust Karlsson Gusti at pallas.dk
Fri Nov 14 08:15:51 EST 2003

Hi all. I'm not quite sure if this is the forum to ask questions about jffs2, but i'll stick my neck out anyway.

My problem is that I have a small MTD system based on 2 AM29F016 chips i.e. 4MB and 32 128K erase sectors.

The definitions of JFFS2_RESERVED_BLOCKS_* are:
#define JFFS2_RESERVED_BLOCKS_BASE 1	//Opr. 3					/* Number of free blocks there must be before we... */
#define JFFS2_RESERVED_BLOCKS_WRITE (JFFS2_RESERVED_BLOCKS_BASE + 1)		/* ... allow a normal filesystem write */
#define JFFS2_RESERVED_BLOCKS_DELETION (JFFS2_RESERVED_BLOCKS_BASE + 1)		/* ... allow a normal filesystem deletion */
#define JFFS2_RESERVED_BLOCKS_GCTRIGGER (JFFS2_RESERVED_BLOCKS_BASE + 2)	/* ... wake up the GC thread */
#define JFFS2_RESERVED_BLOCKS_GCBAD (JFFS2_RESERVED_BLOCKS_BASE + 1)		/* ... pick a block from the bad_list to GC */
#define JFFS2_RESERVED_BLOCKS_GCMERGE (JFFS2_RESERVED_BLOCKS_BASE)		/* ... merge pages when garbage collecting */

On a freshly erased disk I have 14 free blocks, and then during run they decrease to JFFS2_RESERVED_BLOCKS_GCTRIGGER -1 before the garbage collector starts and it seems that the GC only erases down to JFFS2_RESERVED_BLOCKS_GCTRIGGER blocks.

Now I wonder, is there a possibility to force the garbage collector to erase all possibly erasable blocks.
At the moment I have a handle to see if the GC is running and once in a while i start it with SIGHUP if its not running already.
This in due amount of time erases those blocks I want.

But in some situations (software updates) I replace about 1M and after that replacement (and during) the disk access is unacceptably slow.

I would like to, as I know nothing is going to happen for a while, force the GC to erase all possible blocks in one sequence (even if it takes far amount of time) on my command.

Does anybody know if this is possible and how...

On beforehand thanks.


Agust Karlsson            mailto:gusti at pallas.dk
Pallas Informatik A/S     http://www.pallas.dk
Allerød Stationsvej 2D    Tel.: +45 48 10 24 10
DK-3450 Allerød           Fax.: +45 48 10 24 01

More information about the linux-mtd mailing list