summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorYangtao Li <frank.li@vivo.com>2023-04-13 18:59:51 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2023-04-18 18:05:54 +0200
commitc1660d88a064409879f6d467754bbe27259c71bb (patch)
tree4102a23672a3266aeaa28f47ee31b737dece2ef7 /fs/f2fs/segment.h
parentf2fs: relax sanity check if checkpoint is corrupted (diff)
downloadlinux-c1660d88a064409879f6d467754bbe27259c71bb.tar.xz
linux-c1660d88a064409879f6d467754bbe27259c71bb.zip
f2fs: add has_enough_free_secs()
Replace !has_not_enough_free_secs w/ has_enough_free_secs. BTW avoid nested 'if' statements in f2fs_balance_fs(). Signed-off-by: Yangtao Li <frank.li@vivo.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index ac2e35170f2d..2ca8fb5d0dc4 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -643,11 +643,17 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,
return !curseg_space;
}
+static inline bool has_enough_free_secs(struct f2fs_sb_info *sbi,
+ int freed, int needed)
+{
+ return !has_not_enough_free_secs(sbi, freed, needed);
+}
+
static inline bool f2fs_is_checkpoint_ready(struct f2fs_sb_info *sbi)
{
if (likely(!is_sbi_flag_set(sbi, SBI_CP_DISABLED)))
return true;
- if (likely(!has_not_enough_free_secs(sbi, 0, 0)))
+ if (likely(has_enough_free_secs(sbi, 0, 0)))
return true;
return false;
}