On Fri, 2006-02-10 at 16:21 +0000, Jon Masters wrote: > On 2/10/06, Peter Barada wrote: > > > On Fri, 2006-02-10 at 15:39 +0000, Jon Masters wrote: > > > > On 2/9/06, Peter Barada wrote: > > > > > I use a YAFFS1 NOR-based system, and in the writes, we lay > > > > down the data chunk, and then the tag. In the unlikely event that a > > > > power-cycle occurs while writing the data, the tag is still empty, but > > > > some of the data chunk is not erased, and then next time a write occurs > > > > into that chunk, YAFFS sees that the write fails since the previous data > > > > was written(and retires the whole block), even though the tag indicated > > > > the chunk is empty. > > > > That does seem to be preferable over writing the tag twice. > > > Why? > > It just seems to go against the design philosophy of YAFFS, but, as > you point out, you're only changing a single bit. It just doesn't seem > right as a general solution to the problem. Any suggestions for a general solution that can be proven to properly recover for a power failure at *any* point in the process? If I write the tag before the data, then the chunk is considered valid even though the data is not. If the data is first and then the tag, then the tag can indicate that the chunk is available for allocation while the data is not in the erased state. Hence the two-step approach.