diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 38a774c..359deec 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -225,7 +225,7 @@ enum f2fs_config_func { struct f2fs_configuration { u_int32_t sector_size; u_int32_t reserved_segments; - u_int32_t overprovision; + double overprovision; u_int32_t cur_seg[6]; u_int32_t segs_per_sec; u_int32_t secs_per_zone; diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 2d4ab09..176bdea 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -155,19 +155,19 @@ static void configure_extension_list(void) free(config.extension_list); } -static u_int32_t get_best_overprovision(void) +static double get_best_overprovision(void) { - u_int32_t reserved, ovp, candidate, end, diff, space; - u_int32_t max_ovp = 0, max_space = 0; + double reserved, ovp, candidate, end, diff, space; + double max_ovp = 0, max_space = 0; if (get_sb(segment_count_main) < 256) { candidate = 10; end = 95; diff = 5; } else { - candidate = 1; + candidate = 0.01; end = 10; - diff = 1; + diff = 0.01; } for (; candidate <= end; candidate += diff) { @@ -533,7 +533,7 @@ static int f2fs_write_check_point_pack(void) set_cp(overprov_segment_count, get_cp(overprov_segment_count) + get_cp(rsvd_segment_count)); - MSG(0, "Info: Overprovision ratio = %u%%\n", config.overprovision); + MSG(0, "Info: Overprovision ratio = %.3lf%%\n", config.overprovision); MSG(0, "Info: Overprovision segments = %u (GC reserved = %u)\n", get_cp(overprov_segment_count), config.reserved_segments); diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c index fc612d8..2ea809c 100644 --- a/mkfs/f2fs_format_main.c +++ b/mkfs/f2fs_format_main.c @@ -99,7 +99,7 @@ static void f2fs_parse_options(int argc, char *argv[]) config.vol_label = optarg; break; case 'o': - config.overprovision = atoi(optarg); + config.overprovision = atof(optarg); break; case 'O': parse_feature(strdup(optarg));