yaffs New background garbage collector and related tweaks
authorCharles Manning <cdhmanning@gmail.com>
Fri, 16 Apr 2010 03:39:16 +0000 (15:39 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Fri, 16 Apr 2010 03:39:16 +0000 (15:39 +1200)
commit36dc48ebac4140345b3f5955d5013f6c22ad827a
treea16cc169eb156e7aac1f3ef76c8b8e2ac565b8cc
parentc565b5da13774bc9d5f661d93a127ba86a8769e7
yaffs New background garbage collector and related tweaks

This commit
- introduces the yaffs background garbage collection feature
- tweaks the foregound garbage collection to do less work
- changes the way auto-checkpointing works
- tweaks the block refreshing logic.

The aim of the background garbage collector is to do at least some of the
garbage collection in the background so that writing operations will not have
to do as much garbage collection which should make writes faster. The amount of
background garbage collection is controlled by the ratio between the amount of
erased space vs the amount of free space:
* If less than quarter of free space is erased, then background gc is frequent.
* Else if less than a half of the free space is erased, then background gc is
still done reasonably frequently.
* else (at least half of the free space is erased) the background gc is done
infrequently.

Background gc is not attempted if the partition is checkpointed since that would
invalidate the checkpoint.

The auto-checkpointing feature has changed slightly. If the yaffs_auto_checkpoint
value is set to 1 or 2 then the auto checkpointing will be blocked if the erased
space is less than half the free space (ie. the auto-checkpointing is blocked to
allow background gc to progress). Oring in 4 into the yaffs_auto_checkpoint will
do a one-shot override, forcing a checkpoint and suspending background gc until
the partition is dirtied by a write, erase etc.

The block refreshing control has been changed. The dev->param.refreshPeriod now
controls how many blocks are garbage collected before another refresh is performed.
Values around 1000 probably make the best sense.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffscfg2k.c
yaffs_fs.c
yaffs_guts.c