]> git.neil.brown.name Git - LaFS.git/commitdiff
sync: wait for checkpoint to actually finish on a sync
authorNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 01:47:31 +0000 (12:47 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 01:47:31 +0000 (12:47 +1100)
Signed-off-by: NeilBrown <neilb@suse.de>
checkpoint.c
lafs.h
super.c

index c031506043d0ca9f979e650986757b4672a60041..ca20075ca9862d40a48d075ca4d03ce4495d1885 100644 (file)
@@ -626,3 +626,13 @@ void lafs_checkpoint_unlock_wait(struct fs *fs)
                   !test_bit(CheckpointNeeded, &fs->fsstate) &&
                   fs->checkpointing == 0);
 }
+
+void lafs_checkpoint_wait(struct fs *fs)
+{
+       /* Wait until there is no checkpoint requested or happening.
+        * This is used to implement filesystem-wide sync
+        */
+       wait_event(fs->phase_wait,
+                  !test_bit(CheckpointNeeded, &fs->fsstate) &&
+                  fs->checkpointing == 0);
+}
diff --git a/lafs.h b/lafs.h
index 616b3c0c1e9b0cdedfe1a5d440d3ef3e00699401..c8c76848dcdcb7bd1e070379d964c27aed4a85e3 100644 (file)
--- a/lafs.h
+++ b/lafs.h
@@ -709,6 +709,7 @@ struct super_block *lafs_get_subset_sb(struct inode *ino);
 void lafs_checkpoint_lock(struct fs *fs);
 void lafs_checkpoint_unlock(struct fs *fs);
 void lafs_checkpoint_unlock_wait(struct fs *fs);
+void lafs_checkpoint_wait(struct fs *fs);
 unsigned long long lafs_checkpoint_start(struct fs *fs);
 unsigned long lafs_do_checkpoint(struct fs *fs);
 struct block *lafs_get_flushable(struct fs *fs, int phase);
diff --git a/super.c b/super.c
index 7cdde24f84a2f3e486e24f0664316348736299c5..f96c3463b536f2c1dfb630e9e52d5525716c4880 100644 (file)
--- a/super.c
+++ b/super.c
@@ -1336,7 +1336,7 @@ static int lafs_sync_fs(struct super_block *sb, int wait)
                 */
                lafs_checkpoint_start(fs_from_sb(sb));
        else
-               printk("FIXME I should wait for the checkpoint to finish\n");
+               lafs_checkpoint_wait(fs_from_sb(sb));
        return 0;
 }