aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/ioctl.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2012-05-31 19:26:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 20:49:27 -0400
commit11475975dd3c0a8e639f1544ef6530373de5979e (patch)
treee20344e3d296d2271eea093c76fa728e1c341510 /fs/nilfs2/ioctl.c
parenta1d494495c69ef0810cd008f59310d2b9db28e36 (diff)
nilfs2: flush disk caches in syncing
There are two cases that the cache flush is needed to avoid data loss against unexpected hang or power failure. One is sync file function (i.e. nilfs_sync_file) and another is checkpointing ioctl. This issues a cache flush request to device for such cases if barrier mount option is enabled, and makes sure data really is on persistent storage on their completion. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2/ioctl.c')
-rw-r--r--fs/nilfs2/ioctl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 2a70fce70c65..06658caa18bd 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -692,8 +692,14 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
692 if (ret < 0) 692 if (ret < 0)
693 return ret; 693 return ret;
694 694
695 nilfs = inode->i_sb->s_fs_info;
696 if (nilfs_test_opt(nilfs, BARRIER)) {
697 ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
698 if (ret == -EIO)
699 return ret;
700 }
701
695 if (argp != NULL) { 702 if (argp != NULL) {
696 nilfs = inode->i_sb->s_fs_info;
697 down_read(&nilfs->ns_segctor_sem); 703 down_read(&nilfs->ns_segctor_sem);
698 cno = nilfs->ns_cno - 1; 704 cno = nilfs->ns_cno - 1;
699 up_read(&nilfs->ns_segctor_sem); 705 up_read(&nilfs->ns_segctor_sem);