From 41215088185204d7752ed9914ae4d83bbc1fc849 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 25 Jun 2010 16:30:18 +1000 Subject: [PATCH] Improve flushing of 'cleaner' clusters. 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 --- checkpoint.c | 7 +++++++ clean.c | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/checkpoint.c b/checkpoint.c index fc11b0d..a199932 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -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 39fccba..35e5117 100644 --- 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) -- 2.39.5