|
@@ -1639,6 +1639,27 @@ static int f2fs_ioc_gc(struct file *filp, unsigned long arg)
|
|
|
return f2fs_gc(sbi, sync);
|
|
|
}
|
|
|
|
|
|
+static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg)
|
|
|
+{
|
|
|
+ struct inode *inode = file_inode(filp);
|
|
|
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
|
|
+ struct cp_control cpc;
|
|
|
+
|
|
|
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
+ return -EPERM;
|
|
|
+
|
|
|
+ if (f2fs_readonly(sbi->sb))
|
|
|
+ return -EROFS;
|
|
|
+
|
|
|
+ cpc.reason = __get_cp_reason(sbi);
|
|
|
+
|
|
|
+ mutex_lock(&sbi->gc_mutex);
|
|
|
+ write_checkpoint(sbi, &cpc);
|
|
|
+ mutex_unlock(&sbi->gc_mutex);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
{
|
|
|
switch (cmd) {
|
|
@@ -1670,6 +1691,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
return f2fs_ioc_get_encryption_pwsalt(filp, arg);
|
|
|
case F2FS_IOC_GARBAGE_COLLECT:
|
|
|
return f2fs_ioc_gc(filp, arg);
|
|
|
+ case F2FS_IOC_WRITE_CHECKPOINT:
|
|
|
+ return f2fs_ioc_write_checkpoint(filp, arg);
|
|
|
default:
|
|
|
return -ENOTTY;
|
|
|
}
|