Whamcloud - gitweb
e2fsck: print thread log properly
[tools/e2fsprogs.git] / e2fsck / pass1.c
index 00c5758..34bea11 100644 (file)
@@ -1466,6 +1466,10 @@ void e2fsck_pass1_run(e2fsck_t ctx)
                }
                if (!ino)
                        break;
+#ifdef HAVE_PTHREAD
+               if (ctx->global_ctx)
+                       ctx->thread_info.et_inode_number++;
+#endif
                pctx.ino = ino;
                pctx.inode = inode;
                ctx->stashed_ino = ino;
@@ -2363,7 +2367,12 @@ static errcode_t e2fsck_pass1_thread_prepare(e2fsck_t global_ctx, e2fsck_t *thre
        else
                tinfo->et_group_end = average_group * (thread_index + 1);
        tinfo->et_group_next = tinfo->et_group_start;
-
+       tinfo->et_inode_number = 0;
+       tinfo->et_log_buf[0] = '\0';
+       tinfo->et_log_length = 0;
+       if (thread_context->options & E2F_OPT_MULTITHREAD)
+               log_out(thread_context, _("Scan group range [%d, %d)\n"),
+                       tinfo->et_group_start, tinfo->et_group_end);
        thread_context->fs = thread_fs;
        *thread_ctx = thread_context;
        return 0;
@@ -2404,6 +2413,7 @@ static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx
        global_ctx->fs = global_fs;
        global_ctx->logf = global_logf;
        global_ctx->problem_logf = global_problem_logf;
+       global_ctx->global_ctx = NULL;
 
        if (thread_ctx->inode_used_map) {
                retval = e2fsck_pass1_copy_bitmap(global_fs,
@@ -2553,6 +2563,12 @@ static void *e2fsck_pass1_thread(void *arg)
        e2fsck_pass1_run(thread_ctx);
 
 out:
+       if (thread_ctx->options & E2F_OPT_MULTITHREAD)
+               log_out(thread_ctx,
+                       _("Scanned group range [%lu, %lu), inodes %lu\n"),
+                       thread_ctx->thread_info.et_group_start,
+                       thread_ctx->thread_info.et_group_end,
+                       thread_ctx->thread_info.et_inode_number);
        return NULL;
 }
 
@@ -2688,6 +2704,10 @@ static errcode_t scan_callback(ext2_filsys fs,
        if (ctx->global_ctx) {
                tinfo = &ctx->thread_info;
                tinfo->et_group_next++;
+               if (ctx->options & E2F_OPT_DEBUG &&
+                   ctx->options & E2F_OPT_MULTITHREAD)
+                       log_out(ctx, _("group %d finished\n"),
+                               tinfo->et_group_next);
                if (tinfo->et_group_next >= tinfo->et_group_end)
                        return EXT2_ET_SCAN_FINISHED;
        }