From: NeilBrown Date: Fri, 4 Mar 2011 01:47:31 +0000 (+1100) Subject: sync: wait for checkpoint to actually finish on a sync X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=0113e60ede89b4af75197a5b8dee58b3261dda76;p=LaFS.git sync: wait for checkpoint to actually finish on a sync Signed-off-by: NeilBrown --- diff --git a/checkpoint.c b/checkpoint.c index c031506..ca20075 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -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 616b3c0..c8c7684 100644 --- 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 7cdde24..f96c346 100644 --- 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; }