~ubuntu-branches/ubuntu/edgy/e2fsprogs/edgy-updates

« back to all changes in this revision

Viewing changes to misc/mke2fs.c

  • Committer: Bazaar Package Importer
  • Author(s): Tollef Fog Heen
  • Date: 2005-08-23 10:42:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050823104210-t15igvmgrkzea0dq
Tags: 1.38-2ubuntu1
* Merge with Debian.  (Ubuntu #13757)
* Remove tests/f_bad_disconnected_inode/image.gz to be able to build the
  package.  This will (hopefully) be in the next upstream version and is
  just used for testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * mke2fs.c - Make a ext2fs filesystem.
3
3
 * 
4
 
 * Copyright (C) 1994, 1995, 1996, 1997 Theodore Ts'o.
 
4
 * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 
5
 *      2003, 2004, 2005 by Theodore Ts'o.
5
6
 *
6
7
 * %Begin-Header%
7
8
 * This file may be redistributed under the terms of the GNU Public
85
86
int sync_kludge;        /* Set using the MKE2FS_SYNC env. option */
86
87
 
87
88
int sys_page_size = 4096;
 
89
int linux_version_code = 0;
88
90
 
89
91
static void usage(void)
90
92
{
93
95
        " [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] "
94
96
        "[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] "
95
97
        "[-M last-mounted-directory] [-O feature[,...]]\n\t"
96
 
        "[-r fs-revision] [-R raid_opts] [-qvSV] device [blocks-count]\n"),
 
98
        "[-r fs-revision] [-R options] [-qvSV] device [blocks-count]\n"),
97
99
                program_name);
98
100
        exit(1);
99
101
}
119
121
        return l;
120
122
}
121
123
 
 
124
static int parse_version_number(const char *s)
 
125
{
 
126
        int     major, minor, rev;
 
127
        char    *endptr;
 
128
        const char *cp = s;
 
129
 
 
130
        if (!s)
 
131
                return 0;
 
132
        major = strtol(cp, &endptr, 10);
 
133
        if (cp == endptr || *endptr != '.')
 
134
                return 0;
 
135
        cp = endptr + 1;
 
136
        minor = strtol(cp, &endptr, 10);
 
137
        if (cp == endptr || *endptr != '.')
 
138
                return 0;
 
139
        cp = endptr + 1;
 
140
        rev = strtol(cp, &endptr, 10);
 
141
        if (cp == endptr)
 
142
                return 0;
 
143
        return ((((major * 256) + minor) * 256) + rev);
 
144
}
 
145
 
 
146
 
 
147
 
122
148
/*
123
149
 * This function sets the default parameters for a filesystem
124
150
 *
140
166
        { default_str, 3, 1024, 8192 },
141
167
        { "journal", 0, 4096, 8192 },
142
168
        { "news", 0, 4096, 4096 },
143
 
        { "largefile", 0, DEF_MAX_BLOCKSIZE, 1024 * 1024 },
144
 
        { "largefile4", 0, DEF_MAX_BLOCKSIZE, 4096 * 1024 },
 
169
        { "largefile", 0, 4096, 1024 * 1024 },
 
170
        { "largefile4", 0, 4096, 4096 * 1024 },
145
171
        { 0, 0, 0, 0},
146
172
};
147
173
 
172
198
                use_bsize = p->blocksize;
173
199
        }
174
200
        if (blocksize <= 0) {
175
 
                if (use_bsize == DEF_MAX_BLOCKSIZE)
 
201
                if (use_bsize == DEF_MAX_BLOCKSIZE) {
176
202
                        use_bsize = sys_page_size;
 
203
                        if ((linux_version_code < (2*65536 + 6*256)) &&
 
204
                            (use_bsize > 4096))
 
205
                                use_bsize = 4096;
 
206
                }
177
207
                if (sector_size && use_bsize < sector_size)
178
208
                        use_bsize = sector_size;
179
209
                if ((blocksize < 0) && (use_bsize < (-blocksize)))
236
266
        f = popen(buf, "r");
237
267
        if (!f) {
238
268
                com_err("popen", errno,
239
 
                        _("while trying run '%s'"), buf);
 
269
                        _("while trying to run '%s'"), buf);
240
270
                exit(1);
241
271
        }
242
272
        retval = ext2fs_read_bb_FILE(fs, f, bb_list, invalid_block);
494
524
                inode.i_uid = getuid();
495
525
                if (inode.i_uid)
496
526
                        inode.i_gid = getgid();
497
 
                retval = ext2fs_write_inode(fs, EXT2_ROOT_INO, &inode);
 
527
                retval = ext2fs_write_new_inode(fs, EXT2_ROOT_INO, &inode);
498
528
                if (retval) {
499
529
                        com_err("ext2fs_write_inode", retval,
500
530
                                _("while setting root inode ownership"));
656
686
{
657
687
        struct ext2_super_block *s = fs->super;
658
688
        char                    buf[80];
 
689
        char                    *os;
659
690
        blk_t                   group_block;
660
691
        dgrp_t                  i;
661
692
        int                     need, col_left;
668
699
        strncpy(buf, s->s_volume_name, sizeof(s->s_volume_name));
669
700
        printf(_("Filesystem label=%s\n"), buf);
670
701
        fputs(_("OS type: "), stdout);
671
 
        switch (fs->super->s_creator_os) {
672
 
            case EXT2_OS_LINUX: fputs("Linux", stdout); break;
673
 
            case EXT2_OS_HURD:  fputs("GNU/Hurd", stdout);   break;
674
 
            case EXT2_OS_MASIX: fputs ("Masix", stdout); break;
675
 
            default:            fputs(_("(unknown os)"), stdout);
676
 
        }
 
702
        os = e2p_os2string(fs->super->s_creator_os);
 
703
        fputs(os, stdout);
 
704
        free(os);
677
705
        printf("\n");
678
706
        printf(_("Block size=%u (log=%u)\n"), fs->blocksize,
679
707
                s->s_log_block_size);
685
713
                s->s_r_blocks_count,
686
714
               100.0 * s->s_r_blocks_count / s->s_blocks_count);
687
715
        printf(_("First data block=%u\n"), s->s_first_data_block);
 
716
        if (s->s_reserved_gdt_blocks)
 
717
                printf(_("Maximum filesystem blocks=%lu\n"),
 
718
                       (s->s_reserved_gdt_blocks + fs->desc_blocks) *
 
719
                       (fs->blocksize / sizeof(struct ext2_group_desc)) *
 
720
                       s->s_blocks_per_group);
688
721
        if (fs->group_desc_count > 1)
689
722
                printf(_("%u block groups\n"), fs->group_desc_count);
690
723
        else
697
730
                printf("\n");
698
731
                return;
699
732
        }
700
 
        
 
733
 
701
734
        printf(_("Superblock backups stored on blocks: "));
702
735
        group_block = s->s_first_data_block;
703
736
        col_left = 0;
732
765
                sb->s_creator_os = EXT2_OS_HURD;
733
766
        else if (strcasecmp(os, "masix") == 0)
734
767
                sb->s_creator_os = EXT2_OS_MASIX;
 
768
        else if (strcasecmp(os, "freebsd") == 0)
 
769
                sb->s_creator_os = EXT2_OS_FREEBSD;
 
770
        else if (strcasecmp(os, "lites") == 0)
 
771
                sb->s_creator_os = EXT2_OS_LITES;
735
772
        else
736
773
                return 0;
737
774
        return 1;
739
776
 
740
777
#define PATH_SET "PATH=/sbin"
741
778
 
742
 
static void parse_raid_opts(const char *opts)
 
779
static void parse_extended_opts(struct ext2_super_block *param, 
 
780
                                const char *opts)
743
781
{
744
782
        char    *buf, *token, *next, *p, *arg;
745
783
        int     len;
746
 
        int     raid_usage = 0;
 
784
        int     r_usage = 0;
747
785
 
748
786
        len = strlen(opts);
749
787
        buf = malloc(len+1);
750
788
        if (!buf) {
751
 
                fprintf(stderr, _("Couldn't allocate memory to parse "
752
 
                        "raid options!\n"));
 
789
                fprintf(stderr,
 
790
                        _("Couldn't allocate memory to parse options!\n"));
753
791
                exit(1);
754
792
        }
755
793
        strcpy(buf, opts);
759
797
                if (p) {
760
798
                        *p = 0;
761
799
                        next = p+1;
762
 
                } 
 
800
                }
763
801
                arg = strchr(token, '=');
764
802
                if (arg) {
765
803
                        *arg = 0;
767
805
                }
768
806
                if (strcmp(token, "stride") == 0) {
769
807
                        if (!arg) {
770
 
                                raid_usage++;
 
808
                                r_usage++;
771
809
                                continue;
772
810
                        }
773
811
                        fs_stride = strtoul(arg, &p, 0);
774
812
                        if (*p || (fs_stride == 0)) {
775
813
                                fprintf(stderr,
776
 
                                        _("Invalid stride parameter.\n"));
777
 
                                raid_usage++;
778
 
                                continue;
 
814
                                        _("Invalid stride parameter: %s\n"),
 
815
                                        arg);
 
816
                                r_usage++;
 
817
                                continue;
 
818
                        }
 
819
                } else if (!strcmp(token, "resize")) {
 
820
                        unsigned long resize, bpg, rsv_groups;
 
821
                        unsigned long group_desc_count, desc_blocks;
 
822
                        unsigned int gdpb, blocksize;
 
823
                        int rsv_gdb;
 
824
 
 
825
                        if (!arg) {
 
826
                                r_usage++;
 
827
                                continue;
 
828
                        }
 
829
 
 
830
                        resize = parse_num_blocks(arg, 
 
831
                                                  param->s_log_block_size);
 
832
 
 
833
                        if (resize == 0) {
 
834
                                fprintf(stderr, 
 
835
                                        _("Invalid resize parameter: %s\n"),
 
836
                                        arg);
 
837
                                r_usage++;
 
838
                                continue;
 
839
                        }
 
840
                        if (resize <= param->s_blocks_count) {
 
841
                                fprintf(stderr, 
 
842
                                        _("The resize maximum must be greater "
 
843
                                          "than the filesystem size.\n"));
 
844
                                r_usage++;
 
845
                                continue;
 
846
                        }
 
847
 
 
848
                        blocksize = EXT2_BLOCK_SIZE(param);
 
849
                        bpg = param->s_blocks_per_group;
 
850
                        if (!bpg)
 
851
                                bpg = blocksize * 8;
 
852
                        gdpb = blocksize / sizeof(struct ext2_group_desc);
 
853
                        group_desc_count = (param->s_blocks_count +
 
854
                                            bpg - 1) / bpg;
 
855
                        desc_blocks = (group_desc_count +
 
856
                                       gdpb - 1) / gdpb;
 
857
                        rsv_groups = (resize + bpg - 1) / bpg;
 
858
                        rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - 
 
859
                                desc_blocks;
 
860
                        if (rsv_gdb > EXT2_ADDR_PER_BLOCK(param))
 
861
                                rsv_gdb = EXT2_ADDR_PER_BLOCK(param);
 
862
 
 
863
                        if (rsv_gdb > 0) {
 
864
                                param->s_feature_compat |=
 
865
                                        EXT2_FEATURE_COMPAT_RESIZE_INODE;
 
866
 
 
867
                                param->s_reserved_gdt_blocks = rsv_gdb;
779
868
                        }
780
869
                } else
781
 
                        raid_usage++;
 
870
                        r_usage++;
782
871
        }
783
 
        if (raid_usage) {
784
 
                fprintf(stderr, _("\nBad raid options specified.\n\n"
785
 
                        "Raid options are separated by commas, "
 
872
        if (r_usage) {
 
873
                fprintf(stderr, _("\nBad options specified.\n\n"
 
874
                        "Extended options are separated by commas, "
786
875
                        "and may take an argument which\n"
787
876
                        "\tis set off by an equals ('=') sign.\n\n"
788
 
                        "Valid raid options are:\n"
789
 
                        "\tstride=<stride length in blocks>\n\n"));
 
877
                        "Valid extended options are:\n"
 
878
                        "\tstride=<stride length in blocks>\n"
 
879
                        "\tresize=<resize maximum size in blocks>\n\n"));
790
880
                exit(1);
791
881
        }
792
882
}       
793
883
 
794
884
static __u32 ok_features[3] = {
795
885
        EXT3_FEATURE_COMPAT_HAS_JOURNAL |
 
886
                EXT2_FEATURE_COMPAT_RESIZE_INODE |
796
887
                EXT2_FEATURE_COMPAT_DIR_INDEX,  /* Compat */
797
888
        EXT2_FEATURE_INCOMPAT_FILETYPE|         /* Incompat */
798
889
                EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|
809
900
        int             blocksize = 0;
810
901
        int             inode_ratio = 0;
811
902
        int             inode_size = 0;
812
 
        int             reserved_ratio = 5;
 
903
        double          reserved_ratio = 5.0;
813
904
        int             sector_size = 0;
814
905
        int             show_version_only = 0;
815
906
        ext2_ino_t      num_inodes = 0;
816
907
        errcode_t       retval;
817
908
        char *          oldpath = getenv("PATH");
818
 
        char *          raid_opts = 0;
 
909
        char *          extended_opts = 0;
819
910
        const char *    fs_type = 0;
820
 
        int             default_features = 1;
821
911
        blk_t           dev_size;
822
912
#ifdef __linux__
823
913
        struct          utsname ut;
868
958
                perror("uname");
869
959
                exit(1);
870
960
        }
871
 
        if ((ut.release[0] == '1') ||
872
 
            (ut.release[0] == '2' && ut.release[1] == '.' &&
873
 
             ut.release[2] < '2' && ut.release[3] == '.')) {
 
961
        linux_version_code = parse_version_number(ut.release);
 
962
        if (linux_version_code && linux_version_code < (2*65536 + 2*256)) {
874
963
                param.s_rev_level = 0;
875
964
                param.s_feature_incompat = 0;
876
965
                param.s_feature_compat = 0;
887
976
        }
888
977
 
889
978
        while ((c = getopt (argc, argv,
890
 
                    "b:cf:g:i:jl:m:no:qr:R:s:tvI:J:ST:FL:M:N:O:V")) != EOF)
 
979
                    "b:cf:g:i:jl:m:no:qr:s:tvE:FI:J:L:M:N:O:R:ST:V")) != EOF) {
891
980
                switch (c) {
892
981
                case 'b':
893
982
                        blocksize = strtol(optarg, &tmp, 0);
895
984
                        if (b < EXT2_MIN_BLOCK_SIZE ||
896
985
                            b > EXT2_MAX_BLOCK_SIZE || *tmp) {
897
986
                                com_err(program_name, 0,
898
 
                                        _("bad block size - %s"), optarg);
 
987
                                        _("invalid block size - %s"), optarg);
899
988
                                exit(1);
900
989
                        }
901
990
                        if (blocksize > 4096)
916
1005
                        if (size < EXT2_MIN_BLOCK_SIZE ||
917
1006
                            size > EXT2_MAX_BLOCK_SIZE || *tmp) {
918
1007
                                com_err(program_name, 0,
919
 
                                        _("bad fragment size - %s"),
 
1008
                                        _("invalid fragment size - %s"),
920
1009
                                        optarg);
921
1010
                                exit(1);
922
1011
                        }
944
1033
                            inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024 ||
945
1034
                            *tmp) {
946
1035
                                com_err(program_name, 0,
947
 
                                        _("bad inode ratio %s (min %d/max %d"),
 
1036
                                        _("invalid inode ratio %s (min %d/max %d)"),
948
1037
                                        optarg, EXT2_MIN_BLOCK_SIZE,
949
1038
                                        EXT2_MAX_BLOCK_SIZE);
950
1039
                                exit(1);
969
1058
                        strcpy(bad_blocks_filename, optarg);
970
1059
                        break;
971
1060
                case 'm':
972
 
                        reserved_ratio = strtoul(optarg, &tmp, 0);
 
1061
                        reserved_ratio = strtod(optarg, &tmp);
973
1062
                        if (reserved_ratio > 50 || *tmp) {
974
1063
                                com_err(program_name, 0,
975
 
                                        _("bad reserved blocks percent - %s"),
 
1064
                                        _("invalid reserved blocks percent - %s"),
976
1065
                                        optarg);
977
1066
                                exit(1);
978
1067
                        }
983
1072
                case 'o':
984
1073
                        creator_os = optarg;
985
1074
                        break;
 
1075
                case 'q':
 
1076
                        quiet = 1;
 
1077
                        break;
986
1078
                case 'r':
987
 
                        param.s_rev_level = atoi(optarg);
 
1079
                        param.s_rev_level = strtoul(optarg, &tmp, 0);
 
1080
                        if (*tmp) {
 
1081
                                com_err(program_name, 0,
 
1082
                                        _("bad revision level - %s"), optarg);
 
1083
                                exit(1);
 
1084
                        }
988
1085
                        if (param.s_rev_level == EXT2_GOOD_OLD_REV) {
989
1086
                                param.s_feature_incompat = 0;
990
1087
                                param.s_feature_compat = 0;
1004
1101
                        inode_size = strtoul(optarg, &tmp, 0);
1005
1102
                        if (*tmp) {
1006
1103
                                com_err(program_name, 0,
1007
 
                                        _("bad inode size - %s"), optarg);
 
1104
                                        _("invalid inode size - %s"), optarg);
1008
1105
                                exit(1);
1009
1106
                        }
1010
1107
                        break;
1011
1108
#endif
1012
 
                case 'N':
1013
 
                        num_inodes = atoi(optarg);
1014
 
                        break;
1015
1109
                case 'v':
1016
1110
                        verbose = 1;
1017
1111
                        break;
1018
 
                case 'q':
1019
 
                        quiet = 1;
1020
 
                        break;
1021
1112
                case 'F':
1022
1113
                        force = 1;
1023
1114
                        break;
1027
1118
                case 'M':
1028
1119
                        mount_dir = optarg;
1029
1120
                        break;
 
1121
                case 'N':
 
1122
                        num_inodes = strtoul(optarg, &tmp, 0);
 
1123
                        if (*tmp) {
 
1124
                                com_err(program_name, 0,
 
1125
                                        _("bad num inodes - %s"), optarg);
 
1126
                                        exit(1);
 
1127
                        }
 
1128
                        break;
1030
1129
                case 'O':
1031
 
                        if (!strcmp(optarg, "none") || default_features) {
 
1130
                        if (!strcmp(optarg, "none")) {
1032
1131
                                param.s_feature_compat = 0;
1033
1132
                                param.s_feature_incompat = 0;
1034
1133
                                param.s_feature_ro_compat = 0;
1035
 
                                default_features = 0;
1036
 
                        }
1037
 
                        if (!strcmp(optarg, "none"))
1038
1134
                                break;
 
1135
                        }
1039
1136
                        if (e2p_edit_feature(optarg,
1040
1137
                                            &param.s_feature_compat,
1041
1138
                                            ok_features)) {
1044
1141
                                exit(1);
1045
1142
                        }
1046
1143
                        break;
 
1144
                case 'E':
1047
1145
                case 'R':
1048
 
                        raid_opts = optarg;
 
1146
                        extended_opts = optarg;
1049
1147
                        break;
1050
1148
                case 'S':
1051
1149
                        super_only = 1;
1060
1158
                default:
1061
1159
                        usage();
1062
1160
                }
 
1161
        }
1063
1162
        if ((optind == argc) && !show_version_only)
1064
1163
                usage();
1065
 
        device_name = argv[optind];
1066
 
        optind++;
1067
 
        if (optind < argc) {
1068
 
                unsigned long tmp2  = strtoul(argv[optind++], &tmp, 0);
1069
 
 
1070
 
                if ((*tmp) || (tmp2 > 0xfffffffful)) {
1071
 
                        com_err(program_name, 0, _("bad blocks count - %s"),
1072
 
                                argv[optind - 1]);
1073
 
                        exit(1);
1074
 
                }
1075
 
                param.s_blocks_count = tmp2;
1076
 
        }
1077
 
        if (optind < argc)
1078
 
                usage();
 
1164
        device_name = argv[optind++];
1079
1165
 
1080
1166
        if (!quiet || show_version_only)
1081
1167
                fprintf (stderr, "mke2fs %s (%s)\n", E2FSPROGS_VERSION, 
1087
1173
                exit(0);
1088
1174
        }
1089
1175
 
1090
 
        if (raid_opts)
1091
 
                parse_raid_opts(raid_opts);
1092
 
 
1093
1176
        /*
1094
1177
         * If there's no blocksize specified and there is a journal
1095
1178
         * device, use it to figure out the blocksize
1139
1222
        }
1140
1223
        if ((blocksize > 4096) &&
1141
1224
            (param.s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
1142
 
                fprintf(stderr, "\nWarning: some 2.4 kernels do not support "
1143
 
                        "blocksizes greater than 4096 \n\tusing ext3."
1144
 
                        "  Use -b 4096 if this is an issue for you.\n\n");
 
1225
                fprintf(stderr, _("\nWarning: some 2.4 kernels do not support "
 
1226
                        "blocksizes greater than 4096\n\tusing ext3.  "
 
1227
                        "Use -b 4096 if this is an issue for you.\n\n"));
 
1228
 
 
1229
        if (optind < argc) {
 
1230
                param.s_blocks_count = parse_num_blocks(argv[optind++], 
 
1231
                                param.s_log_block_size);
 
1232
                if (!param.s_blocks_count) {
 
1233
                        com_err(program_name, 0, _("invalid blocks count - %s"),
 
1234
                                argv[optind - 1]);
 
1235
                        exit(1);
 
1236
                }
 
1237
        }
 
1238
        if (optind < argc)
 
1239
                usage();
1145
1240
 
1146
1241
        if (param.s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
1147
1242
                if (!fs_type)
1165
1260
        if (noaction && param.s_blocks_count) {
1166
1261
                dev_size = param.s_blocks_count;
1167
1262
                retval = 0;
1168
 
        } else
 
1263
        } else {
 
1264
        retry:
1169
1265
                retval = ext2fs_get_device_size(device_name,
1170
1266
                                                EXT2_BLOCK_SIZE(&param),
1171
1267
                                                &dev_size);
 
1268
                if ((retval == EFBIG) &&
 
1269
                    (blocksize == 0) && 
 
1270
                    (param.s_log_block_size == 0)) {
 
1271
                        param.s_log_block_size = 2;
 
1272
                        blocksize = 4096;
 
1273
                        goto retry;
 
1274
                }
 
1275
        }
 
1276
                        
1172
1277
        if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
1173
1278
                com_err(program_name, retval,
1174
1279
                        _("while trying to determine filesystem size"));
1234
1339
        set_fs_defaults(fs_type, &param, blocksize, sector_size, &inode_ratio);
1235
1340
        blocksize = EXT2_BLOCK_SIZE(&param);
1236
1341
        
 
1342
        if (extended_opts)
 
1343
                parse_extended_opts(&param, extended_opts);
 
1344
 
 
1345
        /* Since sparse_super is the default, we would only have a problem
 
1346
         * here if it was explicitly disabled.
 
1347
         */
 
1348
        if ((param.s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) &&
 
1349
            !(param.s_feature_ro_compat&EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
 
1350
                com_err(program_name, 0,
 
1351
                        _("reserved online resize blocks not supported "
 
1352
                          "on non-sparse filesystem"));
 
1353
                exit(1);
 
1354
        }
 
1355
 
1237
1356
        if (param.s_blocks_per_group) {
1238
1357
                if (param.s_blocks_per_group < 256 ||
1239
1358
                    param.s_blocks_per_group > 8 * (unsigned) blocksize) {
1243
1362
                }
1244
1363
        }
1245
1364
 
 
1365
        if (!force && param.s_blocks_count >= (1 << 31)) {
 
1366
                com_err(program_name, 0,
 
1367
                        _("Filesystem too large.  No more than 2**31-1 blocks\n"
 
1368
                          "\t (8TB using a blocksize of 4k) are currently supported."));
 
1369
             exit(1);
 
1370
        }
 
1371
 
1246
1372
        if (inode_size) {
1247
1373
                if (inode_size < EXT2_GOOD_OLD_INODE_SIZE ||
1248
1374
                    inode_size > EXT2_BLOCK_SIZE(&param) ||
1249
1375
                    inode_size & (inode_size - 1)) {
1250
1376
                        com_err(program_name, 0,
1251
 
                                _("bad inode size %d (min %d/max %d)"),
 
1377
                                _("invalid inode size %d (min %d/max %d)"),
1252
1378
                                inode_size, EXT2_GOOD_OLD_INODE_SIZE,
1253
1379
                                blocksize);
1254
1380
                        exit(1);
1271
1397
         * Calculate number of blocks to reserve
1272
1398
         */
1273
1399
        param.s_r_blocks_count = (param.s_blocks_count * reserved_ratio) / 100;
 
1400
}
1274
1401
 
1275
 
}
1276
 
                                        
1277
1402
int main (int argc, char *argv[])
1278
1403
{
1279
1404
        errcode_t       retval = 0;
1432
1557
                create_lost_and_found(fs);
1433
1558
                reserve_inodes(fs);
1434
1559
                create_bad_block_inode(fs, bb_list);
 
1560
                if (fs->super->s_feature_compat & 
 
1561
                    EXT2_FEATURE_COMPAT_RESIZE_INODE) {
 
1562
                        retval = ext2fs_create_resize_inode(fs);
 
1563
                        if (retval) {
 
1564
                                com_err("ext2fs_create_resize_inode", retval,
 
1565
                                _("while reserving blocks for online resize"));
 
1566
                                exit(1);
 
1567
                        }
 
1568
                }
1435
1569
        }
1436
1570
 
1437
1571
        if (journal_device) {