Whamcloud - gitweb
e2fsck: allow admin specify number of threads
[tools/e2fsprogs.git] / e2fsck / problem.c
index 2d02468..2f2c8fc 100644 (file)
@@ -1279,6 +1279,10 @@ static struct e2fsck_problem problem_table[] = {
          N_("@h %i uses SipHash, but should not.  "),
          PROMPT_CLEAR_HTREE, PR_PREEN_OK, 0, 0, 0 },
 
+       /* Failed to goto block group */
+       { PR_1_SCAN_GOTO,
+         N_("failed to goto block group"),
+          PROMPT_NONE, PR_FATAL, 0, 0, 0 },
 
        /* Pass 1b errors */
 
@@ -1852,7 +1856,7 @@ static struct e2fsck_problem problem_table[] = {
        /* Unconnected directory inode */
        { PR_3_UNCONNECTED_DIR,
          /* xgettext:no-c-format */
-         N_("Unconnected @d @i %i (%p)\n"),
+         N_("Unconnected @d @i %i (was in %q)\n"),
          PROMPT_CONNECT, 0, 0, 0, 0 },
 
        /* /lost+found not found */
@@ -1989,6 +1993,12 @@ static struct e2fsck_problem problem_table[] = {
          N_("/@l is encrypted\n"),
          PROMPT_CLEAR, 0, 0, 0, 0 },
 
+       /* Recursively looped directory inode */
+       { PR_3_LOOPED_DIR,
+         /* xgettext:no-c-format */
+         N_("Recursively looped @d @i %i (%p)\n"),
+         PROMPT_CONNECT, 0, 0, 0, 0 },
+
        /* Pass 3A Directory Optimization       */
 
        /* Pass 3A: Optimizing directories */
@@ -2315,6 +2325,8 @@ int end_problem_latch(e2fsck_t ctx, int mask)
        int answer = -1;
 
        ldesc = find_latch(mask);
+       if (!ldesc)
+               return answer;
        if (ldesc->end_message && (ldesc->flags & PRL_LATCHED)) {
                clear_problem_context(&pctx);
                answer = fix_problem(ctx, ldesc->end_message, &pctx);
@@ -2461,8 +2473,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
         * Do special latch processing.  This is where we ask the
         * latch question, if it exists
         */
-       if (ptr->flags & PR_LATCH_MASK) {
-               ldesc = find_latch(ptr->flags & PR_LATCH_MASK);
+       if (ptr->flags & PR_LATCH_MASK &&
+           (ldesc = find_latch(ptr->flags & PR_LATCH_MASK)) != NULL) {
                if (ldesc->question && !(ldesc->flags & PRL_LATCHED)) {
                        ans = fix_problem(ctx, ldesc->question, pctx);
                        if (ans == 1)
@@ -2486,8 +2498,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                if ((ctx->options & E2F_OPT_PREEN) &&
                    (ptr->flags & PR_PREEN_OK))
                        suppress++;
-               if ((ptr->flags & PR_LATCH_MASK) &&
-                   (ldesc->flags & (PRL_YES | PRL_NO)))
+               if (ldesc && (ldesc->flags & (PRL_YES | PRL_NO)))
                        suppress++;
                if (ptr->count == ptr->max_count + 1) {
                        if (ctx->problem_logf)
@@ -2503,6 +2514,12 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
        if (*message)
                message = _(message);
        if (!suppress) {
+#ifdef HAVE_PTHREAD
+               if ((ctx->options & E2F_OPT_MULTITHREAD) && ctx->global_ctx)
+                       printf("[Thread %d] ",
+                              ctx->thread_info.et_thread_index);
+#endif
+
                if ((ctx->options & E2F_OPT_PREEN) &&
                    !(ptr->flags & PR_PREEN_NOHDR)) {
                        printf("%s: ", ctx->device_name ?
@@ -2532,8 +2549,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                        answer = def_yn;
                        if (!(ptr->flags & PR_PREEN_NOMSG))
                                print_answer = 1;
-               } else if ((ptr->flags & PR_LATCH_MASK) &&
-                          (ldesc->flags & (PRL_YES | PRL_NO))) {
+               } else if (ldesc && (ldesc->flags & (PRL_YES | PRL_NO))) {
                        print_answer = 1;
                        if (ldesc->flags & PRL_YES)
                                answer = 1;