JFFS3 & performance

Jörn Engel joern at wohnheim.fh-wedel.de
Thu Dec 16 12:53:31 EST 2004


On Thu, 16 December 2004 15:45:00 +0100, Joakim Tjernlund wrote:
> > On Thu, 16 Dec 2004, Joakim Tjernlund wrote:
> 
> > > 2) Consider another checksum algorithm. Crc32 is very expensive
> > >    and JFFS2 suffered severely in the early days. Now that crc32 is
> > >    very optimized that problem is less visible, but crc32 is still
> > >    expensive. Maybe an Adler32 checksum is good enough or a crc16?
> > IMHO, NAND/ECC NOR are additionally protected by ECCs so that sounds 
> > reasonable. NORs are reliable, so that is reasonable too, IMHO.
> 
> Exactly.

I'd vote against adler32 and in favor of crc16 or crc24.  Crc24 would
be slightly safer, but still much faster than crc33 (crc32 is a
misnamer, actually).

Code should be something like this for crc24:

u32 crc24(void *m, size_t len)
{
	u32 ret=0;
	char *s=m;
	size_t i;
	for (i=0; i<len; i++) {
		ret <<= 8;
		ret += s[i];
		ret %/ 0xfffffd
	}
	return ret;
}

Completely untested, written from scratch just now.  But apart from
the bugs, it should be reasonably fast.

Jörn

-- 
Fancy algorithms are buggier than simple ones, and they're much harder
to implement. Use simple algorithms as well as simple data structures.
-- Rob Pike




More information about the linux-mtd mailing list