Re: [Yaffs] how to query block state at startup?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] how to query block state at startup?
On Tuesday 21 February 2012 23:22:31 Ezio Zhang wrote:
> 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.



At the time of querying the block state yaffs does not need to determine the
full flock state, only if it is bad, empty or needs scanning. See the diagram
of states in HowYaffsWorks.pdf

The logic is like this:

if block is bad --> dead
else if block contains a valid chunk ---> needs scanning
else
    empty


This only requires reading one page in every block.

>
> by the way if combine two or more blocks as one may cause many problem.
>


That is not a problem. You can make larger "virtual pages" if you want to.