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)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 30 Sep 2014 22:34:47 +0000 (15:34 -0700)
commit7cd8558baa4e4588a80ecb31cb30784195763cdd
treef6c9e24be9fbd339bab3bae92b5b7749d28a1636
parent309cc2b6e7ae6672ff9744fe07735ed234a8994e
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>
fs/f2fs/checkpoint.c
fs/f2fs/debug.c
fs/f2fs/gc.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
fs/f2fs/segment.h