Re: JFFS3 & performance

Jörn Engel
2005-01-08T20:14:59Z

On Thu, 6 January 2005 10:08:16 +0000, Artem B. Bityuckiy wrote:
> On Thu, 23 Dec 2004, [iso-8859-1] Jörn Engel wrote:
>
> > NOR is pretty reliable anyway, so we could just go
> > without a checksum.
>
> Can not agree with you. Checksums are requred even for very reliable NOR
> flashes to be able to detect broken nodes which can appear after unclean
> reboots.
> My understanding is that this is the most important thing why CRCs are
> needed. The media corruption is of lesser priority. From this perspective
> we may easilly use any weaker (then CRC32) checksum, but this checksum
> must be good in detecting partially written nodes.

You win. So I'll go and recheck adler32 wrt. detecting partially
written nodes. There's always the a-priori chance of missing a
change, so we should try to cut that down as far as possible. Since
adler32 has a bit less than 32 bits of non-redundant information, we
might want to cheat a little:

static uint32_t adler32_tailcheck(const void *buf, size_t len)
{
uint32_t end = *(uint32_t*) (buf + len - 4); /* last word */
return adler32(end, buf, len);
}

By using the last word of data as initial value, we put extra emphasis
on it. For long data (full data nodes), this shouldn't make a
difference. On the 12-Byte header, it might make a big one.

> > Correct. Simple parity might be a nice reference as well. It is
> > really bad at catching even-bit errors (2,4,6,...), but it's fast.
>
> And please, bear in mind that if we encounter ECC error, this means error
> somwhere in the page. But this page may contain several JFFS3 nodes and we
> may recover some of them. So, having per-node CRC is good idea even if
> there is ECC (ECC is per-page).
> For example, the board may have been rebooted uncleanly during writing ECC
> (the data was already written, ECC is written after data). In this case we
> may have correct data but just wrong ECC. Having CRCs, we might recover
> all JFFS3 nodes.

Correct, although I don't care too much. If you pull the power while
writing, you'll lose data. Yes, with some care you lose less data,
but some extra milliseconds of power would have done the same.

Jörn

--
Victory in war is not repetitious.
-- Sun Tzu