Revert "f2fs-tools: give less overprovisioning space"

This reverts commit 76a88baa90.

Signed-off-by: zhang-daiyue <zhangdaiyue1@huawei.com>
Change-Id: Id84af613696213680384d8dd9ef8e0b30c9d177b
This commit is contained in:
zhang-daiyue 2024-06-02 14:49:04 +08:00
parent 51558b7dcb
commit 1799d79113
3 changed files with 7 additions and 20 deletions

View File

@ -150,7 +150,7 @@ safe_resize:
c.new_overprovision = get_best_overprovision(sb);
c.new_reserved_segments =
(100 / c.new_overprovision + 1 + NR_CURSEG_TYPE) *
(2 * (100 / c.new_overprovision + 1) + 6) *
get_sb(segs_per_sec);
if ((get_sb(segment_count_main) - 2) < c.new_reserved_segments ||
@ -475,13 +475,8 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
set_cp(overprov_segment_count, (get_newsb(segment_count_main) -
get_cp(rsvd_segment_count)) *
c.new_overprovision / 100);
/* give 2 sections (DATA and NODE) to trigger GC in advance */
if (get_cp(overprov_segment_count) < get_cp(rsvd_segment_count))
set_cp(overprov_segment_count, get_cp(rsvd_segment_count));
set_cp(overprov_segment_count, get_cp(overprov_segment_count) +
2 * get_sb(segs_per_sec));
get_cp(rsvd_segment_count));
DBG(0, "Info: Overprovision ratio = %.3lf%%\n", c.new_overprovision);
DBG(0, "Info: Overprovision segments = %u (GC reserved = %u)\n",
@ -612,8 +607,7 @@ static int f2fs_resize_check(struct f2fs_sb_info *sbi, struct f2fs_super_block *
overprov_segment_count = (get_newsb(segment_count_main) -
c.new_reserved_segments) *
c.new_overprovision / 100;
overprov_segment_count += 2 * get_newsb(segs_per_sec);
overprov_segment_count += c.new_reserved_segments;
user_block_count = (get_newsb(segment_count_main) -
overprov_segment_count) * c.blks_per_seg;

View File

@ -1635,13 +1635,10 @@ static inline double get_best_overprovision(struct f2fs_super_block *sb)
}
for (; candidate <= end; candidate += diff) {
reserved = (100 / candidate + 1 + NR_CURSEG_TYPE) *
reserved = (2 * (100 / candidate + 1) + 6) *
round_up(usable_main_segs, get_sb(section_count));
ovp = (usable_main_segs - reserved) * candidate / 100;
if (ovp < 0)
continue;
space = usable_main_segs - max(reserved, ovp) -
2 * get_sb(segs_per_sec);
space = usable_main_segs - reserved - ovp;
if (max_space < space) {
max_space = space;
max_ovp = candidate;

View File

@ -486,7 +486,7 @@ static int f2fs_prepare_super_block(void)
c.overprovision = get_best_overprovision(sb);
c.reserved_segments =
(100 / c.overprovision + 1 + NR_CURSEG_TYPE) *
(2 * (100 / c.overprovision + 1) + NR_CURSEG_TYPE) *
round_up(f2fs_get_usable_segments(sb), get_sb(section_count));
if (c.feature & cpu_to_le32(F2FS_FEATURE_RO)) {
@ -766,12 +766,8 @@ static int f2fs_write_check_point_pack(void)
set_cp(overprov_segment_count, (f2fs_get_usable_segments(sb) -
get_cp(rsvd_segment_count)) *
c.overprovision / 100);
if (get_cp(overprov_segment_count) < get_cp(rsvd_segment_count))
set_cp(overprov_segment_count, get_cp(rsvd_segment_count));
set_cp(overprov_segment_count, get_cp(overprov_segment_count) +
2 * get_sb(segs_per_sec));
get_cp(rsvd_segment_count));
if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
MSG(0, "\tError: Not enough segments to create F2FS Volume\n");