f2fs: improve searching speed of __next_free_blkoff
To find a zero bit using the result of OR operation between ckpt_valid_map and cur_valid_map is more fast than find a zero bit in each bitmap. Signed-off-by: Changman Lee <cm224.lee@samsung.com> [Jaegeuk Kim: adjust changed function name] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
9a7f143ab5
commit
e81c93cf8c
@ -607,13 +607,18 @@ static void __next_free_blkoff(struct f2fs_sb_info *sbi,
|
|||||||
struct curseg_info *seg, block_t start)
|
struct curseg_info *seg, block_t start)
|
||||||
{
|
{
|
||||||
struct seg_entry *se = get_seg_entry(sbi, seg->segno);
|
struct seg_entry *se = get_seg_entry(sbi, seg->segno);
|
||||||
block_t ofs;
|
int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
|
||||||
for (ofs = start; ofs < sbi->blocks_per_seg; ofs++) {
|
unsigned long target_map[entries];
|
||||||
if (!f2fs_test_bit(ofs, se->ckpt_valid_map)
|
unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
|
||||||
&& !f2fs_test_bit(ofs, se->cur_valid_map))
|
unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
|
||||||
break;
|
int i, pos;
|
||||||
}
|
|
||||||
seg->next_blkoff = ofs;
|
for (i = 0; i < entries; i++)
|
||||||
|
target_map[i] = ckpt_map[i] | cur_map[i];
|
||||||
|
|
||||||
|
pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
|
||||||
|
|
||||||
|
seg->next_blkoff = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user