summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-04 13:01:10 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-17 14:58:52 +0900
commit491c0854b41380f48e422c00ae7e25ae4d02cecc (patch)
treec38f223a14407ecda736da3b9683f7251b4d08bc /fs/f2fs/segment.h
parent924a2ddbd0c2829ebca9ac899522cbb16a9b6d8c (diff)
downloadop-kernel-dev-491c0854b41380f48e422c00ae7e25ae4d02cecc.zip
op-kernel-dev-491c0854b41380f48e422c00ae7e25ae4d02cecc.tar.gz
f2fs: clean up with a macro
This patch adds GET_BLKOFF_FROM_SEG0 to clean up some codes. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 5731682..4024546 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -57,6 +57,9 @@
((blk_addr) - SM_I(sbi)->seg0_blkaddr)
#define GET_SEGNO_FROM_SEG0(sbi, blk_addr) \
(GET_SEGOFF_FROM_SEG0(sbi, blk_addr) >> sbi->log_blocks_per_seg)
+#define GET_BLKOFF_FROM_SEG0(sbi, blk_addr) \
+ (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (sbi->blocks_per_seg - 1))
+
#define GET_SEGNO(sbi, blk_addr) \
(((blk_addr == NULL_ADDR) || (blk_addr == NEW_ADDR)) ? \
NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \
OpenPOWER on IntegriCloud