[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: garbage collect




On Sun, 25 Jun 2000, Bjorn Wesen wrote:

> > you would want to advoid doing any rewriting of these kinds of sectors.
> > Typically over half the flash or more could be allocated to this sort of
> > thing, the rest would be config files and unsed slack.
 
> Yes. In our products we have one read-only filesystem and one r-w system,
> so we dont get the problem you describe below.

Oh, I see.. Since there isn't currently any way to partition MTD devices I
guess you are using multiple physical devices?
 
> > Do you think? I could envision it being fairly simple, all you need is an
> > array mapping your 'logical' sector into a 'physical' sector. logical ones
> > operate in a purely circular way, the physical/logical mapping is selected
> > based on aging and fill like FFS2. (this last bit could be difficult
> > to tune correctly, but is really just a scoring function)
 
> Yeah, you dont even need to store the mapping in the flash either because
> the scan does not care if it scans in weird order. 

Wow, excellent.
 
> Do you have a scoring function to propose ? I guess some heuristic tests
> are needed..

I would suggest something as simple as:

Score = block->fill + block->erases*K
[lower scores are prefered]

K is the tuning constant. Lets presume that if a block has undergone 100
erases then a block with 0 erases should always be prefered over that
block. We can then calcualte K as:

K = sectorsize/100

eg,

Score_100_erase_empty = 0 + 100*SECTSIZE/100 = SECTSIZE
Score_0_erase_full = SECTSIZE + 0 = SECTSIZE

Selecting the '100' number can then be tuning #define, I would guess it
should be approximately 5% of the sector erase lifetime, which could be
given by the lower MTD layers and be chip-specific..

Your ciruclar log can give really good leveling because with a formula
like the above you will be able to swap 'read only' data into high erase
count blocks!

Jason