f2fs: enhance f2fs_is_checkpoint_ready()'s readability
This patch changes sematics of f2fs_is_checkpoint_ready()'s return value as: return true when checkpoint is ready, other return false, it can improve readability of below conditions. f2fs_submit_page_write() ... if (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) || !f2fs_is_checkpoint_ready(sbi)) __submit_merged_bio(io); f2fs_balance_fs() ... if (!f2fs_is_checkpoint_ready(sbi)) return; Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -57,9 +57,11 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
|
||||
err = -EIO;
|
||||
goto err;
|
||||
}
|
||||
err = f2fs_is_checkpoint_ready(sbi);
|
||||
if (err)
|
||||
|
||||
if (!f2fs_is_checkpoint_ready(sbi)) {
|
||||
err = -ENOSPC;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sb_start_pagefault(inode->i_sb);
|
||||
|
||||
@@ -1571,9 +1573,8 @@ static long f2fs_fallocate(struct file *file, int mode,
|
||||
|
||||
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
|
||||
return -EIO;
|
||||
ret = f2fs_is_checkpoint_ready(F2FS_I_SB(inode));
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode)))
|
||||
return -ENOSPC;
|
||||
|
||||
/* f2fs only support ->fallocate for regular file */
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
@@ -3146,13 +3147,10 @@ out:
|
||||
|
||||
long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)))))
|
||||
return -EIO;
|
||||
ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)));
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp))))
|
||||
return -ENOSPC;
|
||||
|
||||
switch (cmd) {
|
||||
case F2FS_IOC_GETFLAGS:
|
||||
|
Reference in New Issue
Block a user