summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-09-23 11:23:01 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2014-09-30 15:34:47 -0700
commit7cd8558baa4e4588a80ecb31cb30784195763cdd (patch)
treef6c9e24be9fbd339bab3bae92b5b7749d28a1636 /fs/f2fs/checkpoint.c
parent309cc2b6e7ae6672ff9744fe07735ed234a8994e (diff)
downloadlinux-7cd8558baa4e4588a80ecb31cb30784195763cdd.tar.gz
linux-7cd8558baa4e4588a80ecb31cb30784195763cdd.tar.bz2
linux-7cd8558baa4e4588a80ecb31cb30784195763cdd.zip
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/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 4abf0ba01525..dd10a031c052 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -98,7 +98,7 @@ static inline block_t get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
case META_CP:
return 0;
case META_POR:
- return SM_I(sbi)->seg0_blkaddr + TOTAL_BLKS(sbi);
+ return MAX_BLKADDR(sbi);
default:
BUG();
}
@@ -113,7 +113,6 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
struct page *page;
block_t blkno = start;
block_t max_blks = get_max_meta_blks(sbi, type);
- block_t min_blks = SM_I(sbi)->seg0_blkaddr;
struct f2fs_io_info fio = {
.type = META,
@@ -146,7 +145,7 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
case META_POR:
if (unlikely(blkno >= max_blks))
goto out;
- if (unlikely(blkno < min_blks))
+ if (unlikely(blkno < SEG0_BLKADDR(sbi)))
goto out;
blk_addr = blkno;
break;