f2fs: check the use of macros on block counts and addresses
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 23 Sep 2014 18:23:01 +0000 (11:23 -0700)
committerIan Chang <ianc@nvidia.com>
Wed, 27 Jan 2016 10:04:17 +0000 (18:04 +0800)
commitf58ce94fee46889e02005f50ae7fcb2ff53ee1bf
treebc8d3f05e42c8c0ee29d4e8f54f89214fc6af532
parent3e16b18e3b296f4414f99f50ceaa5f32bb975d0d
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

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/debug.c
fs/f2fs/gc.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
fs/f2fs/segment.h