diff options
author | Changman Lee <cm224.lee@samsung.com> | 2013-11-14 23:21:16 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-22 20:17:59 -0500 |
commit | e81c93cf8c7bd413898798cf8c67f18b1fef3360 (patch) | |
tree | 6d57a57281d4ade400f3abac03511caf3a81eb34 /fs/f2fs/segment.c | |
parent | 9a7f143ab529352ebef13d3f0f4a09f13efa9435 (diff) |
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>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index aa1d30d76719..67f1e5bbdac9 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -607,13 +607,18 @@ static void __next_free_blkoff(struct f2fs_sb_info *sbi, | |||
607 | struct curseg_info *seg, block_t start) | 607 | struct curseg_info *seg, block_t start) |
608 | { | 608 | { |
609 | struct seg_entry *se = get_seg_entry(sbi, seg->segno); | 609 | struct seg_entry *se = get_seg_entry(sbi, seg->segno); |
610 | block_t ofs; | 610 | int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long); |
611 | for (ofs = start; ofs < sbi->blocks_per_seg; ofs++) { | 611 | unsigned long target_map[entries]; |
612 | if (!f2fs_test_bit(ofs, se->ckpt_valid_map) | 612 | unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map; |
613 | && !f2fs_test_bit(ofs, se->cur_valid_map)) | 613 | unsigned long *cur_map = (unsigned long *)se->cur_valid_map; |
614 | break; | 614 | int i, pos; |
615 | } | 615 | |
616 | seg->next_blkoff = ofs; | 616 | for (i = 0; i < entries; i++) |
617 | target_map[i] = ckpt_map[i] | cur_map[i]; | ||
618 | |||
619 | pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start); | ||
620 | |||
621 | seg->next_blkoff = pos; | ||
617 | } | 622 | } |
618 | 623 | ||
619 | /* | 624 | /* |