f2fs: adjust zone capacity when considering valid block count
This patch fixes counting unusable blocks set by zone capacity when checking the valid block count in a section. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -727,7 +727,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
|
||||
get_valid_blocks(sbi, segno, true);
|
||||
|
||||
f2fs_bug_on(sbi, unlikely(!valid_blocks ||
|
||||
valid_blocks == BLKS_PER_SEC(sbi)));
|
||||
valid_blocks == CAP_BLKS_PER_SEC(sbi)));
|
||||
|
||||
if (!IS_CURSEC(sbi, secno))
|
||||
set_bit(secno, dirty_i->dirty_secmap);
|
||||
@@ -763,7 +763,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
|
||||
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
|
||||
|
||||
if (!valid_blocks ||
|
||||
valid_blocks == BLKS_PER_SEC(sbi)) {
|
||||
valid_blocks == CAP_BLKS_PER_SEC(sbi)) {
|
||||
clear_bit(secno, dirty_i->dirty_secmap);
|
||||
return;
|
||||
}
|
||||
@@ -4484,7 +4484,6 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
|
||||
struct free_segmap_info *free_i = FREE_I(sbi);
|
||||
unsigned int segno = 0, offset = 0, secno;
|
||||
block_t valid_blocks, usable_blks_in_seg;
|
||||
block_t blks_per_sec = BLKS_PER_SEC(sbi);
|
||||
|
||||
while (1) {
|
||||
/* find dirty segment based on free segmap */
|
||||
@@ -4513,7 +4512,7 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
|
||||
valid_blocks = get_valid_blocks(sbi, segno, true);
|
||||
secno = GET_SEC_FROM_SEG(sbi, segno);
|
||||
|
||||
if (!valid_blocks || valid_blocks == blks_per_sec)
|
||||
if (!valid_blocks || valid_blocks == CAP_BLKS_PER_SEC(sbi))
|
||||
continue;
|
||||
if (IS_CURSEC(sbi, secno))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user