+ if (!fs_type) {
+ int megs = (__u64)fs_param.s_blocks_count *
+ (EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024;
+
+ if (fs_param.s_feature_incompat &
+ EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
+ fs_type = "journal";
+ else if (megs <= 3)
+ fs_type = "floppy";
+ else if (megs <= 512)
+ fs_type = "small";
+ else
+ fs_type = "default";
+ }
+
+ /* Figure out what features should be enabled */
+
+ tmp = tmp2 = NULL;
+ if (fs_param.s_rev_level != EXT2_GOOD_OLD_REV) {
+ profile_get_string(profile, "defaults", "base_features", 0,
+ "sparse_super,filetype,resize_inode,dir_index",
+ &tmp);
+ profile_get_string(profile, "fs_types", fs_type,
+ "base_features", tmp, &tmp2);
+ edit_feature(tmp2, &fs_param.s_feature_compat);
+ free(tmp);
+ free(tmp2);
+
+ tmp = tmp2 = NULL;
+ profile_get_string(profile, "defaults", "default_features", 0,
+ "", &tmp);
+ profile_get_string(profile, "fs_types", fs_type,
+ "default_features", tmp, &tmp2);
+ }
+ edit_feature(fs_features ? fs_features : tmp2,
+ &fs_param.s_feature_compat);
+ if (tmp)
+ free(tmp);
+ if (tmp2)
+ free(tmp2);
+
+ if (r_opt == EXT2_GOOD_OLD_REV &&
+ (fs_param.s_feature_compat || fs_param.s_feature_incompat ||
+ fs_param.s_feature_incompat)) {
+ fprintf(stderr, _("Filesystem features not supported "
+ "with revision 0 filesystems\n"));
+ exit(1);
+ }
+
+ if (s_opt > 0) {
+ if (r_opt == EXT2_GOOD_OLD_REV) {
+ fprintf(stderr, _("Sparse superblocks not supported "
+ "with revision 0 filesystems\n"));
+ exit(1);
+ }
+ fs_param.s_feature_ro_compat |=
+ EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
+ } else if (s_opt == 0)
+ fs_param.s_feature_ro_compat &=
+ ~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
+
+ if (journal_size != 0) {
+ if (r_opt == EXT2_GOOD_OLD_REV) {
+ fprintf(stderr, _("Journals not supported "
+ "with revision 0 filesystems\n"));
+ exit(1);
+ }
+ fs_param.s_feature_compat |=
+ EXT3_FEATURE_COMPAT_HAS_JOURNAL;
+ }