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>
This commit is contained in:
@@ -356,7 +356,7 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)
|
||||
* We should do GC or end up with checkpoint, if there are so many dirty
|
||||
* dir/node pages without enough free segments.
|
||||
*/
|
||||
if (has_not_enough_free_secs(sbi, 0)) {
|
||||
if (has_not_enough_free_secs(sbi, 0, 0)) {
|
||||
mutex_lock(&sbi->gc_mutex);
|
||||
f2fs_gc(sbi, false);
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
|
||||
struct curseg_info *curseg = CURSEG_I(sbi, type);
|
||||
const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
|
||||
|
||||
if (IS_NODESEG(type) || !has_not_enough_free_secs(sbi, 0))
|
||||
if (IS_NODESEG(type) || !has_not_enough_free_secs(sbi, 0, 0))
|
||||
return v_ops->get_victim(sbi,
|
||||
&(curseg)->next_segno, BG_GC, type, SSR);
|
||||
|
||||
@@ -1477,7 +1477,7 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
|
||||
|
||||
/* direct_io'ed data is aligned to the segment for better performance */
|
||||
if (direct_io && curseg->next_blkoff &&
|
||||
!has_not_enough_free_secs(sbi, 0))
|
||||
!has_not_enough_free_secs(sbi, 0, 0))
|
||||
__allocate_new_segments(sbi, type);
|
||||
|
||||
*new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
|
||||
|
||||
Reference in New Issue
Block a user