mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
f2fs: check number of blocks in a current section
[ Upstream commit 7af2df0f67a1469762e59be3726a803882d83f6f ] Incfd66bb715("f2fs: fix deadloop in foreground GC"), we needed to check the number of blocks in a section instead of the segment. Fixes:cfd66bb715("f2fs: fix deadloop in foreground GC") Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
@@ -586,23 +586,22 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
|
|||||||
unsigned int node_blocks, unsigned int dent_blocks)
|
unsigned int node_blocks, unsigned int dent_blocks)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int segno, left_blocks;
|
unsigned segno, left_blocks;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* check current node segment */
|
/* check current node sections in the worst case. */
|
||||||
for (i = CURSEG_HOT_NODE; i <= CURSEG_COLD_NODE; i++) {
|
for (i = CURSEG_HOT_NODE; i <= CURSEG_COLD_NODE; i++) {
|
||||||
segno = CURSEG_I(sbi, i)->segno;
|
segno = CURSEG_I(sbi, i)->segno;
|
||||||
left_blocks = f2fs_usable_blks_in_seg(sbi, segno) -
|
left_blocks = CAP_BLKS_PER_SEC(sbi) -
|
||||||
get_seg_entry(sbi, segno)->ckpt_valid_blocks;
|
get_ckpt_valid_blocks(sbi, segno, true);
|
||||||
|
|
||||||
if (node_blocks > left_blocks)
|
if (node_blocks > left_blocks)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check current data segment */
|
/* check current data section for dentry blocks. */
|
||||||
segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno;
|
segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno;
|
||||||
left_blocks = f2fs_usable_blks_in_seg(sbi, segno) -
|
left_blocks = CAP_BLKS_PER_SEC(sbi) -
|
||||||
get_seg_entry(sbi, segno)->ckpt_valid_blocks;
|
get_ckpt_valid_blocks(sbi, segno, true);
|
||||||
if (dent_blocks > left_blocks)
|
if (dent_blocks > left_blocks)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -651,7 +650,7 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,
|
|||||||
|
|
||||||
if (free_secs > upper_secs)
|
if (free_secs > upper_secs)
|
||||||
return false;
|
return false;
|
||||||
else if (free_secs <= lower_secs)
|
if (free_secs <= lower_secs)
|
||||||
return true;
|
return true;
|
||||||
return !curseg_space;
|
return !curseg_space;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user