Whamcloud - gitweb
e2fsck: merge quota context after threads finish
[tools/e2fsprogs.git] / e2fsck / unix.c
index 6a31101..c0aa479 100644 (file)
@@ -82,7 +82,9 @@ static void usage(e2fsck_t ctx)
 
        fprintf(stderr, "%s", _("\nEmergency help:\n"
                " -p                   Automatic repair (no questions)\n"
+#ifdef HAVE_PTHREAD
                " -m                   multiple threads to speedup fsck\n"
+#endif
                " -n                   Make no changes to the filesystem\n"
                " -y                   Assume \"yes\" to all questions\n"
                " -c                   Check for bad blocks and add them to the badblock list\n"
@@ -855,7 +857,11 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
        phys_mem_kb = get_memory_size() / 1024;
        ctx->readahead_kb = ~0ULL;
 
+#ifdef HAVE_PTHREAD
        while ((c = getopt(argc, argv, "pamnyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:")) != EOF)
+#else
+       while ((c = getopt(argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:")) != EOF)
+#endif
                switch (c) {
                case 'C':
                        ctx->progress = e2fsck_update_progress;
@@ -896,9 +902,11 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        }
                        ctx->options |= E2F_OPT_PREEN;
                        break;
+#ifdef HAVE_PTHREAD
                case 'm':
                        ctx->options |= E2F_OPT_MULTITHREAD;
                        break;
+#endif
                case 'n':
                        if (ctx->options & (E2F_OPT_YES|E2F_OPT_PREEN))
                                goto conflict_opt;
@@ -1018,6 +1026,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        _("The -n and -l/-L options are incompatible."));
                fatal_error(ctx, 0);
        }
+#ifdef HAVE_PTHREAD
        if (ctx->options & E2F_OPT_MULTITHREAD) {
                if ((ctx->options & (E2F_OPT_YES|E2F_OPT_NO|E2F_OPT_PREEN)) == 0) {
                        com_err(ctx->program_name, 0, "%s",
@@ -1030,6 +1039,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        fatal_error(ctx, 0);
                }
        }
+#endif
        if (ctx->options & E2F_OPT_NO)
                ctx->options |= E2F_OPT_READONLY;
 
@@ -1453,6 +1463,7 @@ int main (int argc, char *argv[])
        }
        reserve_stdio_fds();
 
+       ctx->global_ctx = NULL;
        set_up_logging(ctx);
        if (ctx->logf) {
                int i;
@@ -1532,6 +1543,7 @@ restart:
        }
 
        ctx->openfs_flags = flags;
+       ctx->io_manager = io_ptr;
        retval = try_open_fs(ctx, flags, io_ptr, &fs);
 
        if (!ctx->superblock && !(ctx->options & E2F_OPT_PREEN) &&