f2fs: clean up some macros in terms of GET_SEGNO
This patch cleans several macros by introducing: - BLKS_PER_SEC - GET_SEC_FROM_SEG - GET_SEG_FROM_SEC - GET_ZONE_FROM_SEC - GET_ZONE_FROM_SEG Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -637,7 +637,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
|
||||
dirty_i->nr_dirty[t]--;
|
||||
|
||||
if (get_valid_blocks(sbi, segno, true) == 0)
|
||||
clear_bit(GET_SECNO(sbi, segno),
|
||||
clear_bit(GET_SEC_FROM_SEG(sbi, segno),
|
||||
dirty_i->victim_secmap);
|
||||
}
|
||||
}
|
||||
@@ -1106,8 +1106,8 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc)
|
||||
continue;
|
||||
}
|
||||
next:
|
||||
secno = GET_SECNO(sbi, start);
|
||||
start_segno = secno * sbi->segs_per_sec;
|
||||
secno = GET_SEC_FROM_SEG(sbi, start);
|
||||
start_segno = GET_SEG_FROM_SEC(sbi, secno);
|
||||
if (!IS_CURSEC(sbi, secno) &&
|
||||
!get_valid_blocks(sbi, start, true))
|
||||
f2fs_issue_discard(sbi, START_BLOCK(sbi, start_segno),
|
||||
@@ -1462,8 +1462,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
|
||||
struct free_segmap_info *free_i = FREE_I(sbi);
|
||||
unsigned int segno, secno, zoneno;
|
||||
unsigned int total_zones = MAIN_SECS(sbi) / sbi->secs_per_zone;
|
||||
unsigned int hint = *newseg / sbi->segs_per_sec;
|
||||
unsigned int old_zoneno = GET_ZONENO_FROM_SEGNO(sbi, *newseg);
|
||||
unsigned int hint = GET_SEC_FROM_SEG(sbi, *newseg);
|
||||
unsigned int old_zoneno = GET_ZONE_FROM_SEG(sbi, *newseg);
|
||||
unsigned int left_start = hint;
|
||||
bool init = true;
|
||||
int go_left = 0;
|
||||
@@ -1473,8 +1473,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
|
||||
|
||||
if (!new_sec && ((*newseg + 1) % sbi->segs_per_sec)) {
|
||||
segno = find_next_zero_bit(free_i->free_segmap,
|
||||
(hint + 1) * sbi->segs_per_sec, *newseg + 1);
|
||||
if (segno < (hint + 1) * sbi->segs_per_sec)
|
||||
GET_SEG_FROM_SEC(sbi, hint + 1), *newseg + 1);
|
||||
if (segno < GET_SEG_FROM_SEC(sbi, hint + 1))
|
||||
goto got_it;
|
||||
}
|
||||
find_other_zone:
|
||||
@@ -1505,8 +1505,8 @@ find_other_zone:
|
||||
secno = left_start;
|
||||
skip_left:
|
||||
hint = secno;
|
||||
segno = secno * sbi->segs_per_sec;
|
||||
zoneno = secno / sbi->secs_per_zone;
|
||||
segno = GET_SEG_FROM_SEC(sbi, secno);
|
||||
zoneno = GET_ZONE_FROM_SEC(sbi, secno);
|
||||
|
||||
/* give up on finding another zone */
|
||||
if (!init)
|
||||
@@ -1550,7 +1550,7 @@ static void reset_curseg(struct f2fs_sb_info *sbi, int type, int modified)
|
||||
struct summary_footer *sum_footer;
|
||||
|
||||
curseg->segno = curseg->next_segno;
|
||||
curseg->zone = GET_ZONENO_FROM_SEGNO(sbi, curseg->segno);
|
||||
curseg->zone = GET_ZONE_FROM_SEG(sbi, curseg->segno);
|
||||
curseg->next_blkoff = 0;
|
||||
curseg->next_segno = NULL_SEGNO;
|
||||
|
||||
|
Reference in New Issue
Block a user