diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2024-04-02 16:44:20 +0000 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2024-04-08 18:10:33 +0000 |
commit | 5da4e5241503b385e4a7e75b1b2bb3367b38be96 (patch) | |
tree | 19fd367dfaf7c522ff77ff1cee55bdfc90f15b36 | |
parent | f611eac6d99cf766ffde76ecac3463774266a4ef (diff) | |
download | f2fs-tools-5da4e5241503b385e4a7e75b1b2bb3367b38be96.tar.gz |
f2fs-tools: give 6 sections for overprovision bufferupstream-master
This addresses high GC cost at runtime.
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | include/f2fs_fs.h | 8 | ||||
-rw-r--r-- | mkfs/f2fs_format.c | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index fc56396..870a6e4 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -1775,6 +1775,12 @@ static inline uint32_t get_reserved(struct f2fs_super_block *sb, double ovp) return round_up(reserved, segs_per_sec) * segs_per_sec; } +static inline uint32_t overprovision_segment_buffer(struct f2fs_super_block *sb) +{ + /* Give 6 current sections to avoid huge GC overheads. */ + return 6 * get_sb(segs_per_sec); +} + static inline double get_best_overprovision(struct f2fs_super_block *sb) { double ovp, candidate, end, diff, space; @@ -1798,7 +1804,7 @@ static inline double get_best_overprovision(struct f2fs_super_block *sb) if (ovp < 0) continue; space = usable_main_segs - max((double)reserved, ovp) - - 2 * get_sb(segs_per_sec); + overprovision_segment_buffer(sb); if (max_space < space) { max_space = space; max_ovp = candidate; diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 8f632f8..e26a513 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -778,7 +778,8 @@ static int f2fs_write_check_point_pack(void) * In non configurable reserved section case, overprovision * segments are always bigger than two sections. */ - if (get_cp(overprov_segment_count) < 2 * get_sb(segs_per_sec)) { + if (get_cp(overprov_segment_count) < + overprovision_segment_buffer(sb)) { MSG(0, "\tError: Not enough overprovision segments (%u)\n", get_cp(overprov_segment_count)); goto free_cp_payload; @@ -787,7 +788,7 @@ static int f2fs_write_check_point_pack(void) get_cp(rsvd_segment_count)); } else { set_cp(overprov_segment_count, get_cp(overprov_segment_count) + - 2 * get_sb(segs_per_sec)); + overprovision_segment_buffer(sb)); } if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) { |