diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-23 14:23:01 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-30 18:34:47 -0400 |
commit | 7cd8558baa4e4588a80ecb31cb30784195763cdd (patch) | |
tree | f6c9e24be9fbd339bab3bae92b5b7749d28a1636 /fs/f2fs/gc.c | |
parent | 309cc2b6e7ae6672ff9744fe07735ed234a8994e (diff) |
f2fs: check the use of macros on block counts and addresses
This patch cleans up the existing and new macros for readability.
Rule is like this.
,-----------------------------------------> MAX_BLKADDR -,
| ,------------- TOTAL_BLKS ----------------------------,
| | |
| ,- seg0_blkaddr ,----- sit/nat/ssa/main blkaddress |
block | | (SEG0_BLKADDR) | | | | (e.g., MAIN_BLKADDR) |
address 0..x................ a b c d .............................
| |
global seg# 0...................... m .............................
| | |
| `------- MAIN_SEGS -----------'
`-------------- TOTAL_SEGS ---------------------------'
| |
seg# 0..........xx..................
= Note =
o GET_SEGNO_FROM_SEG0 : blk address -> global segno
o GET_SEGNO : blk address -> segno
o START_BLOCK : segno -> starting block address
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r-- | fs/f2fs/gc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index e88fcf65aa7f..2a8f4acdb86b 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -193,7 +193,7 @@ static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) | |||
193 | * selected by background GC before. | 193 | * selected by background GC before. |
194 | * Those segments guarantee they have small valid blocks. | 194 | * Those segments guarantee they have small valid blocks. |
195 | */ | 195 | */ |
196 | for_each_set_bit(secno, dirty_i->victim_secmap, TOTAL_SECS(sbi)) { | 196 | for_each_set_bit(secno, dirty_i->victim_secmap, MAIN_SECS(sbi)) { |
197 | if (sec_usage_check(sbi, secno)) | 197 | if (sec_usage_check(sbi, secno)) |
198 | continue; | 198 | continue; |
199 | clear_bit(secno, dirty_i->victim_secmap); | 199 | clear_bit(secno, dirty_i->victim_secmap); |
@@ -281,9 +281,8 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, | |||
281 | unsigned long cost; | 281 | unsigned long cost; |
282 | unsigned int segno; | 282 | unsigned int segno; |
283 | 283 | ||
284 | segno = find_next_bit(p.dirty_segmap, | 284 | segno = find_next_bit(p.dirty_segmap, MAIN_SEGS(sbi), p.offset); |
285 | TOTAL_SEGS(sbi), p.offset); | 285 | if (segno >= MAIN_SEGS(sbi)) { |
286 | if (segno >= TOTAL_SEGS(sbi)) { | ||
287 | if (sbi->last_victim[p.gc_mode]) { | 286 | if (sbi->last_victim[p.gc_mode]) { |
288 | sbi->last_victim[p.gc_mode] = 0; | 287 | sbi->last_victim[p.gc_mode] = 0; |
289 | p.offset = 0; | 288 | p.offset = 0; |