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

Re: garbage collect

On Wed, 28 Jun 2000, Bjorn Wesen wrote:

> > > The location and extent of the partition is given in the partition table
> > > (elsewhere)
> > 
> > Well, we don't have any partitioning ability in the MTD stuff yet.
> That's what you need if you want partitions! :)

I don't really want partitions, I just want the FS to not touch the first
erase sector if there is no FS data there. This is very much like how
FAT/EXT2 reserve the first little bit of their devices for boot loaders.

> That's like splitting the flash into "mini harddisks" of a sector in size
> and having a tiny partition-table in each sector. You could do that but it
> does not map nicely into the device/filesystem split-up.

No, it just makes the filesystem aware of its size and not rely on
external information. Pretty ordinary really.

Actually, with JFFS you could just store a special header node that has
the file system meta data. Start/stop location, creation date, UUID, etc.
> > > With the ptable. The sectors should not need to know about how they
> > > themselves are grouped.
> > 
> > Er, I mean at all. What seperates the spare block from the others?
> I think you lost me here - what is a "spare block" ?

The spare block is the block you have to keep set aside so that you can
use it in the GC process. When you want to compact a block (or in your
case, erase a block) you first erase your spare block then transfer the
data from the block you are going to erase into the spare then arrange for
the old block to be discarded. You have to do this to advoid lossage if
the power is shut off during a GC operation. (you cannot read the block
you want to erase into ram, then compact it and write it out again!)

If the power is shut off in the middle of one of your GC's then you will
have no clear spare and a block that is half populated from the GC
operation, presumably with higher sequence numbers on your nodes..

So how do you recover from a GC operation that is interrupted in the
middle of repopulating the block that was just erased? 
You *must* have some way to discover this half written/erased block and 
force its use in the next GC cycle..