Hi all,<br>
<br>
I've been trying to get the latest CVS version of YAFFS2 to work with a
Samsung K9F2GxxU0M chip which has 2k sector size. I observed the
problem documented some months ago whereby files written to the flash
would disappear upon the next mount.<br>
<br>
I traced the problem down to the fact that the
nandmtd2_QueryNANDBlock() function in yaffs_mtdif2.c is calling
mtd->block_isbad, which is really nand_block_isbad() in
mtd/nand.c. This function is checking if the first byte of OOB
data is 0xFF, and if not is returning that the block is bad.<br>
<br>
However when data is written, the call traces through
nandmtd2_WriteChunkWithTagsToNAND() in yaffs_mtdif2.c, which in turn is
calling yaffs_PackTags2() in yaffs_packedtags2.c. This function
is using a struct yaffs_PackedTags2 to store the OOB data for the
block. This value is being directly written to the OOB area in
the flash. However, there is no accomodation made for the fact
that byte 0 should be 0xFF, and as a result this is why upon mount the
data disappears - YAFFS2 mistakenly thinks it is reading bad blocks,
because it didn't set byte 0 to 0xFF when it wrote the OOB data, byte 0
is instead the LSB of the sequence number.<br>
<br>
If we add a byte to the head of the yaffs_PacketTags2 struct, and set
it to 0xFF in yaffs_PackTags2(), then everything works fine and data
can be read and written good, apparently. However I am wondering
if this is a good fix, or if there are hidden problems that this might
be cause due to the new offset of the rest of OOB data and the
possibility of a byte of OOB data being lost at the end.<br>
<br>
Since we are constrained to use Linux 2.4 I am currently using the
version of MTD I found on <a href="http://husaberg.toby-churchill.com">husaberg.toby-churchill.com</a>, which was
referenced (somewhat obscurely) in earlier posts. I'm not sure if
this is the best version, (other versions I tried showed identical
symptoms) and it was in fact cumbersome to access as there doesn't
appear to be any way to fetch the files except for one at a time
through the web interface.<br>
<br>
Can anyone comment on how good a fix shifting the yaffs_PacketTags2
structure is, or on the location of the newest MTD code which works
with YAFFS2 under Linux 2.4?<br>
<br>
Thanks,<br>
<br>
Michael<br>
<br>