diff options
| author | Yunlei He <heyunlei@huawei.com> | 2017-11-17 16:13:38 +0800 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-02-07 17:53:24 -0800 |
| commit | 2d69561135f2cd0e044657f52a031cea2d0d2652 (patch) | |
| tree | bee2e718d6bdd601b1b2d0ba147d1c4435f4e530 | |
| parent | 4dd2d0733809951ac9ac4acdeefce30519019261 (diff) | |
f2fs: no need to read nat block if nat_block_bitmap is set
No need to read nat block if nat_block_bitmap is set.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/node.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index dca69888d6d3..81972b156ebe 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1952,9 +1952,6 @@ static void scan_nat_page(struct f2fs_sb_info *sbi, unsigned int nat_ofs = NAT_BLOCK_OFFSET(start_nid); int i; - if (test_bit_le(nat_ofs, nm_i->nat_block_bitmap)) - return; - __set_bit_le(nat_ofs, nm_i->nat_block_bitmap); i = start_nid % NAT_ENTRY_PER_BLOCK; @@ -2059,10 +2056,13 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) down_read(&nm_i->nat_tree_lock); while (1) { - struct page *page = get_current_nat_page(sbi, nid); + if (!test_bit_le(NAT_BLOCK_OFFSET(nid), + nm_i->nat_block_bitmap)) { + struct page *page = get_current_nat_page(sbi, nid); - scan_nat_page(sbi, page, nid); - f2fs_put_page(page, 1); + scan_nat_page(sbi, page, nid); + f2fs_put_page(page, 1); + } nid += (NAT_ENTRY_PER_BLOCK - (nid % NAT_ENTRY_PER_BLOCK)); if (unlikely(nid >= nm_i->max_nid)) |
