summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-11-29 00:26:03 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2018-12-14 17:38:02 +0300
commit0cd6d9b0d23416af3bfb8736f8be5bb66bc8060b (patch)
treef8c2139010c431fa412b368de149070655fad08a /fs/f2fs/file.c
parenta742fd41c02c34e0b1b39ee366eb4982837439df (diff)
downloadlinux-0cd6d9b0d23416af3bfb8736f8be5bb66bc8060b.tar.xz
f2fs: add an ioctl() to explicitly trigger fsck later
This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by setting a NEED_FSCK flag. Generally, shutdown is used for the test to validate filesystem consistency, and setting NEED_FSCK flag can be used for Android to trigger fsck.f2fs at boot time explicitly so that we could measure the elapsed time as well as force filesystem check. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ff82350a2c55..ca9bdbb8651b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
f2fs_stop_checkpoint(sbi, false);
set_sbi_flag(sbi, SBI_IS_SHUTDOWN);
break;
+ case F2FS_GOING_DOWN_NEED_FSCK:
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ /* do checkpoint only */
+ ret = f2fs_sync_fs(sb, 1);
+ if (ret)
+ goto out;
+ break;
default:
ret = -EINVAL;
goto out;