On Wednesday 09 July 2014 13:23:16 Ally, Christopher wrote:
> Hi,
>
> I noticed on the UBIFS website they describe a problem with unstable bits.
> The problem is described here:
> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_unstable_bits
>
> Basically, they talk about data instabilities that are caused by power cuts
> while writing or erasing. Obviously, they don’t handle these properly.
>
> Does YAFFS2 handle such cases, or does yaffs2 also have an unstable bits
> problem when power is cut while erasing or writing?
>
Providing an adequate answer to such a complex issue in an email is very hard.
Whether or not unstable bits will cause corruptions will depend on many
factors including both hardware and software.
There are also various things you can do in hardware to improve the situation.
For example most systems probably have sufficient residual power to power the
NAND flash for the few milli seconds required to perform an erasure. If the
driver checks the power good signal before erasing or writing then it should
be enough to prevent power loss during actual erasure/programming.
Clearly if data is completely destroyed then no file system can recover it.
Only some sort of RAID mechanism can do that. (FWIW, I have dabbled with a
raid layer to run over Yaffs).
However, much of the susceptibility will depend on the software. The Yaffs log
structuring mechanism makes it far more robust against corruption (NB not all
log structures have the same properties).
Yaffs does certain things (eg. not using partial page writing) which reduce
the possibility of corruption.
From my experiences using UBIFS, I was not at all impressed by its robustness
to power failure. Even at a file system level (ie. ignoring low-level bit
flips) I have seen UBIFS frequently lose data on various systems. Replacing
UBIFS with Yaffs made those problems go away.
Yaffs undergoes frequent power failure testing on simulators and real
hardware.
Yaffs also periodically undergoes simulator fuzz testing which randomly
trashes bits. While this of course can destroy individual files, this does
not destroy the whole file system.
I guess the short answer is that nothing is going to be perfect, but Yaffs is
going to be generally robust.
Regards
Charles