Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63fcf8e8 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: use segment number for get_valid_blocks



This patch fixes to submit a segment number for get_valid_blocks.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 68afcf2d
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -80,6 +80,8 @@
		GET_SEGNO_FROM_SEG0(sbi, blk_addr)))
		GET_SEGNO_FROM_SEG0(sbi, blk_addr)))
#define GET_SECNO(sbi, segno)					\
#define GET_SECNO(sbi, segno)					\
	((segno) / (sbi)->segs_per_sec)
	((segno) / (sbi)->segs_per_sec)
#define GET_SEGNO_FROM_SECNO(sbi, secno)				\
	((secno) * (sbi)->segs_per_sec)
#define GET_ZONENO_FROM_SEGNO(sbi, segno)				\
#define GET_ZONENO_FROM_SEGNO(sbi, segno)				\
	(((segno) / (sbi)->segs_per_sec) / (sbi)->secs_per_zone)
	(((segno) / (sbi)->segs_per_sec) / (sbi)->secs_per_zone)


@@ -720,8 +722,8 @@ static inline block_t sum_blk_addr(struct f2fs_sb_info *sbi, int base, int type)
static inline bool no_fggc_candidate(struct f2fs_sb_info *sbi,
static inline bool no_fggc_candidate(struct f2fs_sb_info *sbi,
						unsigned int secno)
						unsigned int secno)
{
{
	if (get_valid_blocks(sbi, secno, sbi->segs_per_sec) >=
	if (get_valid_blocks(sbi, GET_SEGNO_FROM_SECNO(sbi, secno),
						sbi->fggc_threshold)
				sbi->segs_per_sec) >= sbi->fggc_threshold)
		return true;
		return true;
	return false;
	return false;
}
}