[Yaffs] Bad block management

Aras Vaichas arasv@magellan-technology.com
Thu, 03 Feb 2005 10:47:43 +1100


Jacob Dall wrote:
> Hello Aras,
> 
> At 02:37 31-01-2005, you wrote:
> 
>> Jacob Dall wrote:
>>
>>>>> I've a few questions regarding why yaffs' bad block management is 
>>>>> designed
>>>>> the way it is.
>>>>> I've an issue with some of my devices - bad blocks is increased very
>>>>> rapidly. Beyond the fact that it's due to ECC read errors, I'm yet to
>>>>> discover the root of the problem.
>>>>
>>>>
>>>> What do you mean by  rapidly? I assume it is far worse than either 
>>>> of these!
>>>
>>> Yes, it's far worse. Imagine having a system that, when looked at, 
>>> has 2 bad blocks. One hour later it has over 500!!
>>> And this in a system that every 15 second writes approc. 10KB of data
>>
>>
>> I had exactly this same problem and it was fixed by using the proper 
>> ECC settings but I am using the kernel module version of YAFFS as 
>> opposed to the "direct" version.
> 
> 
> I'm a bit curious; what settings did you change to achieve 'proper ECC 
> settings'?

Since I was backporting the MTD drivers (2.6.x) for my (technically) 
unsupported version (2.4.x), I had to make a small patch for where it checked 
the kernel version and set "eccbytes" to the correct value. After making this 
change, my system had no more ECC problems and I was able to read/write 
multi-megabyte files without losing memory.

If you look at the two links that I posted earlier ...

>> http://www.aleph1.co.uk/pipermail/yaffs/2004q4/000854.html
>> http://www.aleph1.co.uk/pipermail/yaffs/2004q4/000868.html

they will explain it all.

Here is an annotated version of my YAFFS Makefile in case it might be useful. 
It might not be 100% correct, but it works.

USE_MTD = -DCONFIG_YAFFS_MTD_ENABLED
USE_NANDECC = -DCONFIG_YAFFS_USE_NANDECC
ENABLE_SHORT_NAMES_IN_RAM = -DCONFIG_SHORT_NAMES_IN_RAM

YAFFS_CONFIGS = $(USE_RAM_FOR_TEST) $(USE_MTD) $(USE_GENERIC_RW) 
$(USE_HEADER_FILE_SIZE) $(IGNORE_CHUNK_ERASED) $(IGNORE_WRITE_VERIFY) \
                 $(ENABLE_SHORT_NAMES_IN_RAM) $(USE_NANDECC) $(USE_OLD_MTD) 
$(USE_WRONGECC) \
                 $(ENABLE_YAFFS_MTD_24BACKPORT)

O_TARGET := yaffs.o
obj-y   := yaffs_fs.o yaffs_guts.o yaffs_ramem.o yaffs_mtdif.o yaffs_ecc.o
obj-m   := $(O_TARGET)
EXTRA_CFLAGS += $(YAFFS_CONFIGS)
include $(TOPDIR)/Rules.make


regards,

Aras