From 3f205a1413cfeb581ad1cdf72b500dcadb356682 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Mon, 13 Apr 2009 22:26:31 +0000 Subject: [PATCH] reluctant gc will now wait until the sector has no free pages before erasing the sector. --- core/cfs/cfs-coffee.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/cfs/cfs-coffee.c b/core/cfs/cfs-coffee.c index c9011c609..dfade506e 100644 --- a/core/cfs/cfs-coffee.c +++ b/core/cfs/cfs-coffee.c @@ -281,7 +281,11 @@ collect_garbage(int mode) get_sector_status(sector, &stats); PRINTF("Coffee: Sector %u has %u active, %u free, and %u obsolete pages.\n", sector, (unsigned)stats.active, (unsigned)stats.free, (unsigned)stats.obsolete); - if(stats.active == 0 && stats.obsolete > 0) { + if(stats.active > 0) { + continue; + } + if((mode == GC_RELUCTANT && stats.free == 0) || + (mode == GC_GREEDY && stats.obsolete > 0)) { COFFEE_ERASE(sector); PRINTF("Coffee: Erased sector %d!\n", sector); first_page = sector * COFFEE_PAGES_PER_SECTOR; @@ -289,7 +293,7 @@ collect_garbage(int mode) *next_free = first_page; } if(mode == GC_RELUCTANT) { - break; + break; } } }