From: NeilBrown Date: Sun, 16 Aug 2009 05:20:30 +0000 (+1000) Subject: Cleaner: make sure we finish the job. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=5827db89261808cfc8d2682b7e06ab569bd90497;p=LaFS.git Cleaner: make sure we finish the job. If there might be blocks in the ->cleaning list even after we have read all of the cluster headers. So make sure we continue cleaning until all of those are dealt with. --- diff --git a/clean.c b/clean.c index 1f48ea9..a48f4a3 100644 --- a/clean.c +++ b/clean.c @@ -266,7 +266,7 @@ static int try_clean(struct fs *fs, struct toclean *tc) struct datablock *b, *tmp; dprintk("try_clean: state = %d\n", tc->ac.state); - if (tc->ch == NULL) { + if (tc->ch == NULL && tc->ss) { /* Need to read in the cluster header */ int err; err = lafs_load_page_async(fs, tc->chead, @@ -580,7 +580,7 @@ static unsigned long do_clean(struct fs *fs) int doflush = 1; for (i = 0; i < 4 ; i++) { struct toclean *tc = &fs->cleaner.seg[i]; - if (tc->ss) { + if (tc->ss || !list_empty(&tc->cleaning)) { /* Might be something to do here */ int done = try_clean(fs, tc); if (done < 0) diff --git a/roll.c b/roll.c index 4b551f3..43c7699 100644 --- a/roll.c +++ b/roll.c @@ -560,8 +560,10 @@ lafs_mount(struct fs *fs) lafs_checkpoint_lock(fs); err = roll_forward(fs); lafs_checkpoint_unlock(fs); - for (d = 0; d < 4; d++) + for (d = 0; d < 4; d++) { fs->cleaner.seg[d].chead = alloc_page(GFP_KERNEL); + INIT_LIST_HEAD(&fs->cleaner.seg[d].cleaning); + } return err; err: