mirror of
https://git.openwrt.org/project/make_ext4fs.git
synced 2024-11-21 06:40:40 -05:00
Allow specifying reserved blocks percentage
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
67cbf164c7
commit
828ec043d2
@ -39,6 +39,7 @@ struct fs_info {
|
|||||||
uint16_t feat_compat;
|
uint16_t feat_compat;
|
||||||
uint16_t feat_incompat;
|
uint16_t feat_incompat;
|
||||||
uint32_t bg_desc_reserve_blocks;
|
uint32_t bg_desc_reserve_blocks;
|
||||||
|
uint32_t reserve_pcnt;
|
||||||
const char *label;
|
const char *label;
|
||||||
uint8_t no_journal;
|
uint8_t no_journal;
|
||||||
};
|
};
|
||||||
|
@ -191,7 +191,7 @@ void ext4_fill_in_sb()
|
|||||||
|
|
||||||
sb->s_inodes_count = info.inodes_per_group * aux_info.groups;
|
sb->s_inodes_count = info.inodes_per_group * aux_info.groups;
|
||||||
sb->s_blocks_count_lo = aux_info.len_blocks;
|
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_blocks_count_lo = 0;
|
||||||
sb->s_free_inodes_count = 0;
|
sb->s_free_inodes_count = 0;
|
||||||
sb->s_first_data_block = aux_info.first_data_block;
|
sb->s_first_data_block = aux_info.first_data_block;
|
||||||
@ -533,4 +533,3 @@ int read_ext(int fd, int verbose)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,6 +456,7 @@ int make_ext4fs_internal(int fd, const char *_directory,
|
|||||||
|
|
||||||
printf(" Blocks: %"PRIu64"\n", aux_info.len_blocks);
|
printf(" Blocks: %"PRIu64"\n", aux_info.len_blocks);
|
||||||
printf(" Block groups: %d\n", aux_info.groups);
|
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);
|
printf(" Reserved block group size: %d\n", info.bg_desc_reserve_blocks);
|
||||||
|
|
||||||
ext4_sparse_file = sparse_file_new(info.block_size, info.len);
|
ext4_sparse_file = sparse_file_new(info.block_size, info.len);
|
||||||
|
@ -35,7 +35,7 @@ static void usage(char *path)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
|
fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
|
||||||
fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
|
fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
|
||||||
fprintf(stderr, " [ -L <label> ] [ -f ]\n");
|
fprintf(stderr, " [ -m <reserved blocks percent> ] [ -L <label> ] [ -f ]\n");
|
||||||
fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
|
fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
|
||||||
fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
|
fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
|
||||||
fprintf(stderr, " <filename> [<directory>]\n");
|
fprintf(stderr, " <filename> [<directory>]\n");
|
||||||
@ -58,7 +58,7 @@ int main(int argc, char **argv)
|
|||||||
time_t fixed_time = -1;
|
time_t fixed_time = -1;
|
||||||
FILE* block_list_file = NULL;
|
FILE* block_list_file = NULL;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:T:C:B:fwzJsctv")) != -1) {
|
while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:T:C:B:m:fwzJsctv")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'l':
|
case 'l':
|
||||||
info.len = parse_num(optarg);
|
info.len = parse_num(optarg);
|
||||||
@ -118,6 +118,9 @@ int main(int argc, char **argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
info.reserve_pcnt = strtoul(optarg, NULL, 0);
|
||||||
|
break;
|
||||||
default: /* '?' */
|
default: /* '?' */
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
Loading…
Reference in New Issue
Block a user