Whamcloud - gitweb
e2fsck: add support for dirdata feature
[tools/e2fsprogs.git] / e2fsck / unix.c
index fe88356..4cda592 100644 (file)
@@ -791,6 +791,22 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                                extended_usage++;
                                continue;
                        }
+               /* -E inode_badness_threshold=<value> */
+               } else if (strcmp(token, "inode_badness_threshold") == 0) {
+                       unsigned int val;
+
+                       if (!arg) {
+                               extended_usage++;
+                               continue;
+                       }
+                       val = strtoul(arg, &p, 0);
+                       if (*p != '\0' || (val < 3 && val != 0) || val > 200) {
+                               fprintf(stderr, _("Invalid badness '%s'\n"),
+                                       arg);
+                               extended_usage++;
+                               continue;
+                       }
+                       ctx->inode_badness_threshold = val;
                } else if (strcmp(token, "journal_only") == 0) {
                        if (arg) {
                                extended_usage++;
@@ -866,6 +882,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                fputs(("\tshared=<preserve|lost+found|delete>\n"), stderr);
                fputs(("\tclone=<dup|zero>\n"), stderr);
                fputs(("\texpand_extra_isize\n"), stderr);
+               fputs(("\tinode_badness_threhold=(value)\n"), stderr);
                fputs("\toptimize_extents\n", stderr);
                fputs("\tno_optimize_extents\n", stderr);
                fputs("\tinode_count_fullmap\n", stderr);
@@ -949,6 +966,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 
        phys_mem_kb = get_memory_size() / 1024;
        ctx->readahead_kb = ~0ULL;
+       ctx->inode_badness_threshold = BADNESS_THRESHOLD;
 
 #ifdef HAVE_PTHREAD
        while ((c = getopt(argc, argv, "pam:nyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:")) != EOF)
@@ -1965,6 +1983,14 @@ print_unsupp_features:
                goto get_newer;
        }
 
+       if (ext2fs_has_feature_dirdata(sb) &&
+           ext2fs_has_feature_casefold(sb)) {
+               com_err(ctx->program_name, 0,
+                       _("%s has both casefold and dirdata, aborting fsck"),
+                       ctx->filesystem_name);
+               fatal_error(ctx, 0);
+       }
+
        if (ext2fs_has_feature_casefold(sb) && !fs->encoding) {
                log_err(ctx, _("%s has unsupported encoding: %0x\n"),
                        ctx->filesystem_name, sb->s_encoding);