mkfs.f2fs: support <1% overprovision ratio
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 25 Sep 2015 16:31:04 +0000 (09:31 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 25 Sep 2015 17:32:12 +0000 (10:32 -0700)
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>
include/f2fs_fs.h
mkfs/f2fs_format.c
mkfs/f2fs_format_main.c

index 38a774c..359deec 100644 (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;
index 2d4ab09..176bdea 100644 (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);
index fc612d8..2ea809c 100644 (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));