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

Garbage collection on nearly-full filesystem

I've got a beast here with a 16Mb JFFS root filesystem, and a 15Mb 
secondary filesystem on which I'm playing around.

My testing at the moment is limited to 'cp -a /usr /mnt/' and 
'rm -r /mnt/usr/'. After copying about 5 copies of /lib and /usr into the 
test partition, I told it 'rm -rf lib3'

That was an hour an twenty minutes ago. It's still garbage collecting. I 
don't think it was much more than about half-full.

On each scan through the flash, I believe that it's moving lots and lots of
completely clean erase blocks from one location in the flash to another. 
It would be nice if we could optimise this a little.

It should be possible to leave those blocks in place, and have the log 
write round them to the next unclean block on the flash, shouldn't it?

To maintain wear levelling, we could have a simple algorithm which does 
actually more one clean block in 20 - something like...

 if (next_block_to_be_erased_is_actually_clean()
			&& !(jiffies % 20))

Does this make sense?