diff options
author | Chao Yu <yuchao0@huawei.com> | 2019-08-23 11:58:36 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-09-07 01:18:26 +0200 |
commit | 00e09c0bccc71825ca9a659eb145ed7c4dc95588 (patch) | |
tree | 102a0fee320d40270360f9908a04d7a28a3c67da /fs/f2fs/file.c | |
parent | f2fs: clean up __bio_alloc()'s parameter (diff) | |
download | linux-00e09c0bccc71825ca9a659eb145ed7c4dc95588.tar.xz linux-00e09c0bccc71825ca9a659eb145ed7c4dc95588.zip |
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>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 344e0bd638e5..6528216ab832 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -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: |