diff options
author | Fan Li <fanofcode.li@samsung.com> | 2017-06-02 15:45:42 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-07-04 02:11:34 -0700 |
commit | 72fdbe2efe3e42a54e268d2ee2a8c0828d3996e7 (patch) | |
tree | 4d2abe0f9dedc0a2107152c812653838f77a5e0d /fs/f2fs/node.h | |
parent | 21d3f8e1c3b7996ce239ab6fa82e9f7a8c47d84d (diff) | |
download | linux-72fdbe2efe3e42a54e268d2ee2a8c0828d3996e7.tar.gz linux-72fdbe2efe3e42a54e268d2ee2a8c0828d3996e7.tar.bz2 linux-72fdbe2efe3e42a54e268d2ee2a8c0828d3996e7.zip |
f2fs: simplify the way of calulating next nat address
The index of segment which the next nat block is in has only one different
bit than the current one, so to get the next nat address, we can simply
alter that one bit.
Signed-off-by: Fan Li <fanofcode.li@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.h')
-rw-r--r-- | fs/f2fs/node.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h index 558048e33cf9..bb53e9955ff2 100644 --- a/fs/f2fs/node.h +++ b/fs/f2fs/node.h @@ -224,11 +224,7 @@ static inline pgoff_t next_nat_addr(struct f2fs_sb_info *sbi, struct f2fs_nm_info *nm_i = NM_I(sbi); block_addr -= nm_i->nat_blkaddr; - if ((block_addr >> sbi->log_blocks_per_seg) % 2) - block_addr -= sbi->blocks_per_seg; - else - block_addr += sbi->blocks_per_seg; - + block_addr ^= 1 << sbi->log_blocks_per_seg; return block_addr + nm_i->nat_blkaddr; } |