From: Jo-Philipp Wich Date: Wed, 8 Apr 2015 05:45:53 +0000 (+0200) Subject: Allow specifying reserved blocks percentage X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=828ec043d24e6963d6fd3957262ff5382e262adc;p=project%2Fmake_ext4fs.git Allow specifying reserved blocks percentage Signed-off-by: Jo-Philipp Wich --- diff --git a/ext4_sb.h b/ext4_sb.h index 832fa33..d6416a7 100644 --- a/ext4_sb.h +++ b/ext4_sb.h @@ -39,6 +39,7 @@ struct fs_info { uint16_t feat_compat; uint16_t feat_incompat; uint32_t bg_desc_reserve_blocks; + uint32_t reserve_pcnt; const char *label; uint8_t no_journal; }; diff --git a/ext4_utils.c b/ext4_utils.c index ef77b72..2f1dbb2 100644 --- a/ext4_utils.c +++ b/ext4_utils.c @@ -191,7 +191,7 @@ void ext4_fill_in_sb() sb->s_inodes_count = info.inodes_per_group * aux_info.groups; sb->s_blocks_count_lo = aux_info.len_blocks; - sb->s_r_blocks_count_lo = 0; + sb->s_r_blocks_count_lo = (aux_info.len_blocks / 100) * info.reserve_pcnt; sb->s_free_blocks_count_lo = 0; sb->s_free_inodes_count = 0; sb->s_first_data_block = aux_info.first_data_block; @@ -533,4 +533,3 @@ int read_ext(int fd, int verbose) return 0; } - diff --git a/make_ext4fs.c b/make_ext4fs.c index d25dc0c..edfa25c 100644 --- a/make_ext4fs.c +++ b/make_ext4fs.c @@ -456,6 +456,7 @@ int make_ext4fs_internal(int fd, const char *_directory, printf(" Blocks: %"PRIu64"\n", aux_info.len_blocks); printf(" Block groups: %d\n", aux_info.groups); + printf(" Reserved blocks: %"PRIu64"\n", (aux_info.len_blocks / 100) * info.reserve_pcnt); printf(" Reserved block group size: %d\n", info.bg_desc_reserve_blocks); ext4_sparse_file = sparse_file_new(info.block_size, info.len); diff --git a/make_ext4fs_main.c b/make_ext4fs_main.c index b0edaa5..88254c3 100644 --- a/make_ext4fs_main.c +++ b/make_ext4fs_main.c @@ -35,7 +35,7 @@ static void usage(char *path) { fprintf(stderr, "%s [ -l ] [ -j ] [ -b ]\n", basename(path)); fprintf(stderr, " [ -g ] [ -i ] [ -I ]\n"); - fprintf(stderr, " [ -L