[Yaffs] Need help replacing yaffs1 by yaffs2

Jacob Dall jacob.dall@operamail.com
Wed, 15 Dec 2004 08:52:18 +0100


Hello Charles,

I understand what you are saying, but as I read the code, that's not what's 
in fact happening.

I use 512-byte pages (and yaffs1 compatability mode) and 
dev->writeChunkWithTagsToNAND is not defined.

Then, reading the yaffs_WriteChunkWithTagsToNAND in yaffs_guts.c, it shows 
that a yaffs_TagsCompatabilityWriteChunkWithTagsToNAND function is executed:
<code>
static Y_INLINE int yaffs_WriteChunkWithTagsToNAND(yaffs_Device *dev,int 
chunkInNAND, const __u8 *buffer, yaffs_ExtendedTags *tags)
{
<snip>
</snip>
         if(dev->writeChunkWithTagsToNAND)
                 return 
dev->writeChunkWithTagsToNAND(dev,chunkInNAND,buffer,tags);
         else
                 return 
yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(dev,chunkInNAND,buffer,tags);
}
</code>

In yaffs_TagsCompatabilityWriteChunkWithTagsToNAND (yaffs_tagscompat.c), 
yaffs_LoadTagsIntoSpare is called. In here, an ECC is generated for the 
tags. Having loaded tags into spare, the yaffs_WriteChunkToNAND is called, 
and it just calls dev->writeChunkToNAND.

You were saying:
>If you use 512-byte pages (and yaffs1 mode compatabiliuty mode) then you
>can use the tags compatability functions. These will call yaffs_ecc.c.
Could you please explain where the data ECC is generated? I do not see from 
where the call to yaffs_ecc code is executed. Though I see some code that's 
either commented out or hidden from the compiler by #if 0.

I've fetched the latest yaffs2 code from cvs, and I've made no changes to 
the code, except for the yaffs_flashif part.

Thanks,
Jacob

At 23:09 12-12-2004, Charles Manning wrote:
>On Saturday 11 December 2004 12:24, Jacob Dall wrote:
> > Please, I need some help.
> >
> > I want to replace yaffs1 direct with yaffs2 direct, but I've some trouble.
> >
> > I've compiled the code with the CFLAGS as defined in the direct/makefile:
> > CONFIG_YAFFS_DIRECT, CONFIG_YAFFS_SHORT_NAMES_IN_RAM and
> > CONFIG_YAFFS_YAFFS2. I'm a bit in doubt about the last define - is it ok
> > setting it when one wants to do what I want?
> >
> > I've completed a low-lewel check of the flash, using my implementation of
> > the interface functions in direct/yaffs_flashif.c. The test is done by
> > writing some well-known values to the data and spare area of each chunk,
> > reading it back and verifying byte by byte. I do not allow any diffs. It
> > runs to perfection - I get no errors at all.
> >
> > Now, starting up yaffs (of course I did erase all blocks after the
> > low-level check was completed), mounting a device and opening, writing and
> > closing some files, for each file I get some 'ecc error unfixed' notes, and
> > a block is marked for retirement. I don't get that, taking into
> > consideration that my previous test showed no issues at all.
> >
> > Digging into the code, I can't seem to locate the spot where data ecc is
> > calculated (beyond some code not being active, either by #ifdef 0 or //).
>
>In YAFFS2 the ecc tests have been moved out of yaffs_guts to make a better
>partitioning of the file system from the NAND and ECC logic.
>
>The ECC is done within the ReadChunkWithTags and WriteChunkWithTags functions.
>
>If you use 512-byte pages (and yaffs1 mode compatabiliuty mode) then you
>can use the tags compatability functions. These will call yaffs_ecc.c.
>
>For 2kbyte pages etc, using full-blown yaffs2 mode, the ECC must be done in
>the NAND layer. THis can be done using yaffs_ecc.c
>
> >
> > I tend to believe that what I want to achieve is either unsupported or
> > untested. Am I right?
>
>It is supported in a more flexible way. It just mean that ECC checking for 2k
>pages should be done in the NAND access layer.
>
> >
> > Still, I don't get it - where is the data ecc supposed to be calculated?