On 2012-02-21 07:25, Ross Younger wrote: > On 21/02/12 19:06, Ezio Zhang wrote: > > As yaffs just provides a interface for query block鈥檚 state and not > > implement it,I鈥檓 confused about how to archieve this work EFFICIENTLY. > > YAFFS needs to know whether or not the block is marked as bad. It's > quite common for a NAND driver to keep a table of known-bad blocks (both > those marked bad at the factory, and those that have worn out in use). > This is what the Linux MTD layer does. The first time you use a chip, > you have to scan it looking for factory-bad markers and build up the > initial table; once you have that, it is stored on the chip (taking up a > block or two) and is very quick to look up later. > > > Some one suggest me to scan the whole flash,but I think it will cost to > > much time when nand flash is big. > > If your nand flash array is really large, you may want to consider > trading off time for spatial efficiency: use virtual pages and/or > virtual blocks that are larger than your chip's physical pages and blocks. > > > Ross > > Thank you. But you may misunderstood my meaning. Bad is not the only state of a block in yaffs.a block may be ‘full’,’empty’,’need_scan’,’dirty’and many other states that yaffs defined. What I am not sure is how to jude these states. by the way if combine two or more blocks as one may cause many problem. --- Best regards, Ezio