* [PATCH] f2fs: simplify the way of calulating next nat address
[not found] <CGME20170602074702epcas5p2afcfc8a3bb05e1916f6d93abe1958a5a@epcas5p2.samsung.com>
@ 2017-06-02 7:45 ` Fan Li
2017-06-03 1:38 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Fan Li @ 2017-06-02 7:45 UTC (permalink / raw)
To: 'Jaegeuk Kim', 'Chao Yu'; +Cc: linux-f2fs-devel
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>
---
fs/f2fs/node.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 558048e..da0b21b 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -224,10 +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;
}
--
2.7.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] f2fs: simplify the way of calulating next nat address
2017-06-02 7:45 ` [PATCH] f2fs: simplify the way of calulating next nat address Fan Li
@ 2017-06-03 1:38 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2017-06-03 1:38 UTC (permalink / raw)
To: Fan Li, 'Jaegeuk Kim'; +Cc: linux-f2fs-devel
On 2017/6/2 15:45, Fan Li wrote:
> 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>
Thanks,
> ---
> fs/f2fs/node.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
> index 558048e..da0b21b 100644
> --- a/fs/f2fs/node.h
> +++ b/fs/f2fs/node.h
> @@ -224,10 +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;
> }
> --
> 2.7.4
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-03 1:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170602074702epcas5p2afcfc8a3bb05e1916f6d93abe1958a5a@epcas5p2.samsung.com>
2017-06-02 7:45 ` [PATCH] f2fs: simplify the way of calulating next nat address Fan Li
2017-06-03 1:38 ` Chao Yu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.