summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-04-07 14:27:07 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2017-04-10 19:48:11 -0700
commit63fcf8e8d6bff2e8228f348c78b4a4fcca44401a (patch)
treec1486dd7e160df89e29480dfc7bd8568eeb108a1 /fs/f2fs
parent68afcf2d38cd7544817558757e57e7b9d5c4e72c (diff)
f2fs: use segment number for get_valid_blocks
This patch fixes to submit a segment number for get_valid_blocks. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index b8a1bac9355d..39ef9cc0093b 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -80,6 +80,8 @@
GET_SEGNO_FROM_SEG0(sbi, blk_addr)))
#define GET_SECNO(sbi, segno) \
((segno) / (sbi)->segs_per_sec)
+#define GET_SEGNO_FROM_SECNO(sbi, secno) \
+ ((secno) * (sbi)->segs_per_sec)
#define GET_ZONENO_FROM_SEGNO(sbi, segno) \
(((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,
unsigned int secno)
{
- if (get_valid_blocks(sbi, secno, sbi->segs_per_sec) >=
- sbi->fggc_threshold)
+ if (get_valid_blocks(sbi, GET_SEGNO_FROM_SECNO(sbi, secno),
+ sbi->segs_per_sec) >= sbi->fggc_threshold)
return true;
return false;
}