On Sunday 24 November 2002 20:00, Nick Bane wrote: > Well I might offer one more instance - and that relates to yaffs too. That > is when the fs uses other parts of the oob data and is running on chips > that only accept two writes to the oob area. Under those circumstances we > want the fs and not the mtd layer to do the writing assuming that a second > write to the oob is part of the fs's bad block strategy. If I understand YAFFS correctly, then the OOB data are written in one go together with data. So the fs supplies all oob data except ECC and the driver fills in either SW or HW generated ECC at the appropriate place for the calling fs. So fs supplied OOB data and ECC are written in one cycle. It's not a two step procedure. > Also, if I am being picky, I believe that hardware assisted ecc can be > implemented where the hardware just does the arithmetic. It is then up to > the driver to read that data and write it out to the oob. If it *really* > wanted to, an fs could ignore the results and write something else. This > would make it reasonable for fs's on different partitions to use/ignore the > Hardware ECC. Yep, but I assume, that somebody, who has HW ECC is willing to use it. And all NAND aware filesystems will use ECC. I was curious and modified YAFFS to use nand ecc. It works. The modifications are really small. I copied files around with nandecc enabled and verified it afterwards with nandecc disabled. Enable/disable is in YAFFS only, not in nand.c, where NAND_SW_ECC is selected for the hole chip, as I have a JFFS2 root partition on the same chip. This runs on top of current MTD-CVS without any modification. The NAND driver HW-ECC support is therefore available for YAFFS out of the box. A penalty is that I have to copy oob data around on read, because NAND driver returns 16Byte OOB data and 2 x 4 Byte ECC correction result. This was a request of Charles, when we discussed some YAFFS issues before I did the big nand.c overhaul. This behaviour is a subject, which could be changed, as the only user would be YAFFS at the moment, AFAIK. A further improvement would be to use the NAND driver write verify function and skip this function in YAFFS. Therefor the return value from mtd->write_ecc has to be evaluated inside YAFFS. This would be recommended, if you intend to use JFFS2 and YAFFS together and want to have the write verify for both filesystems. At the moment a double checking is done for YAFFS, if it is enabled in the nand driver. JFFS2 does not support write verify in the fs layer. It relies on the write verify of the nand driver and handles the results. Patch attached. Jeffrey: Forgive me, that I did not change the if statements. I was to lazy :) I have added a section about this issue to http://www.linux-mtd.infradead.org/tech/nand.html. -- Thomas ____________________________________________________ linutronix - competence in embedded & realtime linux http://www.linutronix.de mail: tglx@linutronix.de