mkfs.f2fs: support <1% overprovision ratio

Big partition size needs uner 1% overprovision space to acquire more space.

    section  ovp ratio  ovp size
For 8TB,
    -s1    : 0.07%     -> 10GB
    -s32   : 0.39%     -> 65GB
    -s64   : 0.55%     -> 92GB
    -s128  : 0.78%     -> 132GB

For 128GB,
    -s1    : 0.55%     -> 1.4GB
    -s32   : 3.14%     -> 8GB
    -s64   : 4.45%     -> 12GB
    -s128  : 6.32%     -> 17GB

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2015-09-25 09:31:04 -07:00
parent e8766f2887
commit 2cdb04b52f
3 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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));