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>
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);
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)