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