diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-09-01 12:02:51 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-09-12 10:30:41 -0700 |
commit | 7f3037a5ec0672e03f96d4b0b86169c4c48e479e (patch) | |
tree | 66b71b995cbd04ccfa395f6ac487c6204c03b32a /fs/f2fs/segment.h | |
parent | ed214a11830a12a83511eb32415e71f1a0760b8a (diff) | |
download | linux-7f3037a5ec0672e03f96d4b0b86169c4c48e479e.tar.gz linux-7f3037a5ec0672e03f96d4b0b86169c4c48e479e.tar.bz2 linux-7f3037a5ec0672e03f96d4b0b86169c4c48e479e.zip |
f2fs: check free_sections for defragmentation
Fix wrong condition check for defragmentation of a file.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r-- | fs/f2fs/segment.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 87156c739796..fecb856ad874 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -479,7 +479,8 @@ static inline bool need_SSR(struct f2fs_sb_info *sbi) reserved_sections(sbi) + 1); } -static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, int freed) +static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, + int freed, int needed) { int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); @@ -489,8 +490,8 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, int freed) if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) return false; - return (free_sections(sbi) + freed) <= (node_secs + 2 * dent_secs + - reserved_sections(sbi)); + return (free_sections(sbi) + freed) <= + (node_secs + 2 * dent_secs + reserved_sections(sbi) + needed); } static inline bool excess_prefree_segs(struct f2fs_sb_info *sbi) |