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/recovery.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/recovery.c')
-rw-r--r-- | fs/f2fs/recovery.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 947b92273d08..ebd013225788 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c | |||
@@ -173,8 +173,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) | |||
173 | while (1) { | 173 | while (1) { |
174 | struct fsync_inode_entry *entry; | 174 | struct fsync_inode_entry *entry; |
175 | 175 | ||
176 | if (blkaddr < SM_I(sbi)->main_blkaddr || | 176 | if (blkaddr < MAIN_BLKADDR(sbi) || blkaddr >= MAX_BLKADDR(sbi)) |
177 | blkaddr >= (SM_I(sbi)->seg0_blkaddr + TOTAL_BLKS(sbi))) | ||
178 | return 0; | 177 | return 0; |
179 | 178 | ||
180 | page = get_meta_page_ra(sbi, blkaddr); | 179 | page = get_meta_page_ra(sbi, blkaddr); |
@@ -434,8 +433,7 @@ static int recover_data(struct f2fs_sb_info *sbi, | |||
434 | while (1) { | 433 | while (1) { |
435 | struct fsync_inode_entry *entry; | 434 | struct fsync_inode_entry *entry; |
436 | 435 | ||
437 | if (blkaddr < SM_I(sbi)->main_blkaddr || | 436 | if (blkaddr < MAIN_BLKADDR(sbi) || blkaddr >= MAX_BLKADDR(sbi)) |
438 | blkaddr >= (SM_I(sbi)->seg0_blkaddr + TOTAL_BLKS(sbi))) | ||
439 | break; | 437 | break; |
440 | 438 | ||
441 | page = get_meta_page_ra(sbi, blkaddr); | 439 | page = get_meta_page_ra(sbi, blkaddr); |
@@ -525,7 +523,7 @@ out: | |||
525 | 523 | ||
526 | /* truncate meta pages to be used by the recovery */ | 524 | /* truncate meta pages to be used by the recovery */ |
527 | truncate_inode_pages_range(META_MAPPING(sbi), | 525 | truncate_inode_pages_range(META_MAPPING(sbi), |
528 | SM_I(sbi)->main_blkaddr << PAGE_CACHE_SHIFT, -1); | 526 | MAIN_BLKADDR(sbi) << PAGE_CACHE_SHIFT, -1); |
529 | 527 | ||
530 | if (err) { | 528 | if (err) { |
531 | truncate_inode_pages_final(NODE_MAPPING(sbi)); | 529 | truncate_inode_pages_final(NODE_MAPPING(sbi)); |