From 5383d401ccce0566006897ba873600e5505aa782 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 10 Jul 2010 07:34:25 +1000 Subject: [PATCH] Reinstitute a BUG_ON in checkpoint_unlock_wait and doco it. When waiting for the checkpoint to pass, we need to have triggered a checkpoint to start somehow. Signed-off-by: NeilBrown --- checkpoint.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/checkpoint.c b/checkpoint.c index 485f47b..9cf7c46 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -583,17 +583,15 @@ void lafs_checkpoint_unlock(struct fs *fs) void lafs_checkpoint_unlock_wait(struct fs *fs) { -// unsigned long long seq = fs->wc[0].cluster_seq; - - // FIXME what is this about? BUG_ON(!fs->checkpoint_needed); + /* FIXME it is a bug if we haven't done something to + * make a checkpoint happen, else we could wait forever. + * As we still hold the lock prepare_checkpoint cannot + * have progressed, so CheckpointNeeded must be set. + */ + BUG_ON(!test_bit(CheckpointNeeded, &fs->fsstate) && + !test_bit(CleanerBlocks, &fs->fsstate)); lafs_checkpoint_unlock(fs); - // lafs_cluster_wait(fs, seq); - /* FIXME I need to wait until it is worth trying to lock again, - * but what do I wait for?? - * I used to wait for the next cluster to go, but that isn't - * right?? - */ wait_event(fs->phase_wait, !test_bit(CleanerBlocks, &fs->fsstate) && !test_bit(CheckpointNeeded, &fs->fsstate) && -- 2.39.5