]> git.neil.brown.name Git - LaFS.git/commitdiff
Cleaner: make sure we finish the job.
authorNeilBrown <neilb@suse.de>
Sun, 16 Aug 2009 05:20:30 +0000 (15:20 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 16 Aug 2009 05:20:30 +0000 (15:20 +1000)
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.

clean.c
roll.c

diff --git a/clean.c b/clean.c
index 1f48ea995d00115d9ebcb081ce3735d7c7ff5b68..a48f4a301f25d1e19358e953a663a9a7ed5f3cd4 100644 (file)
--- 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 4b551f3ed3ddb557d0cac5f023a4dc74317d8686..43c7699e02c579578e7dc1a19f02639d14318d30 100644 (file)
--- 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: