]> git.neil.brown.name Git - LaFS.git/commitdiff
Clean up interaction between cleaner and checkpoint.
authorNeilBrown <neilb@suse.de>
Sat, 14 Aug 2010 06:48:39 +0000 (16:48 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 14 Aug 2010 07:58:20 +0000 (17:58 +1000)
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 <neilb@suse.de>
checkpoint.c
clean.c
segments.c

index 8bf84c5728b49bc58e347576045b36d2616cd6ab..fca7bee76ea71ff7bfeb2de455fba7f143fe9238 100644 (file)
@@ -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 641b6b483d6f7ad8940df0a4bb7ae7056d1c4847..1884542ee133f36070a9cf7c4d1a04484182ae49 100644 (file)
--- 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)) {
index 6091449f64eea1746680c4e22e1a7af8efd683f9..214cba75a7e37f761188cfd59f2d099f5d7036ba 100644 (file)
@@ -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;
                }