]> git.neil.brown.name Git - LaFS.git/commitdiff
Improve flushing of 'cleaner' clusters.
authorNeilBrown <neilb@suse.de>
Fri, 25 Jun 2010 06:30:18 +0000 (16:30 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 25 Jun 2010 06:30:18 +0000 (16:30 +1000)
There is no need for the cleaner to ever wait for block which
have been written.  Once the write has been requested, the block
will not be Realloc any more, and so will not get back onto the
clean_leaf list anyway.

So just flush out the cluster when everything is done.
Earlier flushes will happen when a segment gets full.

Just to be safe, also flush the cleaner cluster before a checkpoint.
If there is anything awaiting flushing, it will be invisible
to the checkpoint process, but will hold other blocks pinned
so the checkpoint will not be able to proceed.

Signed-off-by: NeilBrown <neilb@suse.de>
checkpoint.c
clean.c

index fc11b0d0793432228f587eb24a5216313b9fe2cf..a199932f5328eb575953f559c73e35b410060182 100644 (file)
@@ -460,6 +460,13 @@ unsigned long lafs_do_checkpoint(struct fs *fs)
 
        if (fs->cleaner.active)
                return HZ/10; /* FIXME that is gross ... is it needed? */
+
+       /* Make sure all cleaner blocks are flushed as if anything lingers
+        * in the cleaner cluster, they will stop the checkpoint from making
+        * progress.
+        */
+       lafs_cluster_flush(fs, 1);
+
        /* OK, time for some work. */
        dprintk("############################ start checkpoint\n");
        y = prepare_checkpoint(fs);
diff --git a/clean.c b/clean.c
index 39fccbaa43e49995c2ee8dd3828b4ae86499a159..35e5117bade9ad646df291ecd1574d38a8e2547a 100644 (file)
--- a/clean.c
+++ b/clean.c
@@ -248,12 +248,8 @@ static void cleaner_flush(struct fs *fs)
                        lafs_iounlock_block(b);
                putref(b, MKREF(leaf));
 
-               if (list_empty(&fs->clean_leafs)) {
-                       lafs_cluster_flush(fs, 1);
-                       /* FIXME wait?? */
-                       lafs_cluster_wait_all(fs);
-               }
        }
+       lafs_cluster_flush(fs, 1);
 }
 
 static int try_clean(struct fs *fs, struct toclean *tc)