From 543e4448ce8cc7739a0c583f5854836718b9c4cd Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 14 Aug 2010 16:48:39 +1000 Subject: [PATCH] Clean up interaction between cleaner and checkpoint. If a checkpoint is wanted, the cleaner shouldn't start any more work. If the cleaner or segscan is active a checkpoint cannot start, but when they complete they should wake the checkpoint process. Signed-off-by: NeilBrown --- checkpoint.c | 2 +- clean.c | 3 ++- segments.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/checkpoint.c b/checkpoint.c index 8bf84c5..fca7bee 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -541,7 +541,7 @@ unsigned long lafs_do_checkpoint(struct fs *fs) return MAX_SCHEDULE_TIMEOUT; if (fs->cleaner.active || ! fs->scan.done) - return HZ/10; /* FIXME that is gross ... is it needed? */ + return MAX_SCHEDULE_TIMEOUT; /* Make sure all cleaner blocks are flushed as if anything lingers * in the cleaner cluster, they will stop the checkpoint from making diff --git a/clean.c b/clean.c index 641b6b4..1884542 100644 --- a/clean.c +++ b/clean.c @@ -460,6 +460,7 @@ unsigned long lafs_do_clean(struct fs *fs) * */ if (!fs->cleaner.active && + !test_bit(CheckpointNeeded, &fs->fsstate) && !test_bit(CleanerDisabled, &fs->fsstate)) { /* choose to clean when the fraction of all space that is clean * is below the faction of free space that is not clean. @@ -572,7 +573,7 @@ unsigned long lafs_do_clean(struct fs *fs) cleaner_flush(fs); if (cnt == 0) { fs->cleaner.active = 0; - wake_up(&fs->async_complete); + lafs_wake_thread(fs); } } if (test_bit(CleanerBlocks, &fs->fsstate)) { diff --git a/segments.c b/segments.c index 6091449..214cba7 100644 --- a/segments.c +++ b/segments.c @@ -1786,7 +1786,7 @@ unsigned long lafs_scan_seg(struct fs *fs) } if (dev == -1) { fs->scan.done = 1; - wake_up(&fs->phase_wait); + lafs_wake_thread(fs); return MAX_SCHEDULE_TIMEOUT; } -- 2.39.5