]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: allow extent tree optimization to be disabled
authorTheodore Ts'o <tytso@mit.edu>
Sat, 15 Apr 2017 13:22:27 +0000 (09:22 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 21 Apr 2017 07:33:47 +0000 (03:33 -0400)
Add an extended option, -E no_optimize_extents, as well as a
e2fsck.conf profile option, to disable extent tree optimization.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/e2fsck.8.in
e2fsck/e2fsck.conf.5.in
e2fsck/e2fsck.h
e2fsck/extents.c
e2fsck/unix.c

index 915273d87bb7f2ac3433eb12b9ce69bda00284a7..4ad575f40b3eacb054201fcaf73feb2465524c0c 100644 (file)
@@ -226,6 +226,10 @@ option may prevent you from further manual data recovery.
 Do not attempt to discard free blocks and unused inode blocks. This option is
 exactly the opposite of discard option. This is set as default.
 .TP
+.BI no_optimize_extents
+Do not offer to optimize the extent tree by eliminating unnecessary
+width or depth.
+.TP
 .BI readahead_kb
 Use this many KiB of memory to pre-fetch metadata in the hopes of reducing
 e2fsck runtime.  By default, this is set to the size of two block groups' inode
index 0bfc76abb34164dae1b04f4aa6efed74293745d8..94525baf0e318caf7f36404b7e9f8f929d4746fd 100644 (file)
@@ -205,6 +205,10 @@ of that type are squelched.  This can be useful if the console is slow
 (i.e., connected to a serial port) and so a large amount of output could
 end up delaying the boot process for a long time (potentially hours).
 .TP
+.I no_optimize_extents
+Do not offer to optimize the extent tree by eliminating unnecessary
+width or depth.
+.TP
 .I readahead_mem_pct
 Use this percentage of memory to try to read in metadata blocks ahead of the
 main e2fsck thread.  This should reduce run times, depending on the speed of
index f3568106e65cb5b3749cb99532db557f44ca9dd1..6ab4f9cca84d07b0e6c3cb783a61c4612a01e10e 100644 (file)
@@ -169,6 +169,7 @@ struct resource_track {
 #define E2F_OPT_DISCARD                0x2000
 #define E2F_OPT_CONVERT_BMAP   0x4000 /* convert blockmap to extent */
 #define E2F_OPT_FIXES_ONLY     0x8000 /* skip all optimizations */
+#define E2F_OPT_NOOPT_EXTENTS  0x10000 /* don't optimize extents */
 
 /*
  * E2fsck flags
index 7f28e6dd36a3a493113ff935054f097fef19dc1d..98cf7c37a94315a0444c7cce59cc135aa9954a3e 100644 (file)
@@ -521,6 +521,9 @@ errcode_t e2fsck_should_rebuild_extents(e2fsck_t ctx,
        if (eti->force_rebuild)
                goto rebuild;
 
+       if (ctx->options & E2F_OPT_NOOPT_EXTENTS)
+               return 0;
+
        extents_per_block = (ctx->fs->blocksize -
                             sizeof(struct ext3_extent_header)) /
                            sizeof(struct ext3_extent);
index b7322bc6a11488709d47b59db919690ce8e0a91c..b6025535586abe213c51f9bcdffd4c42a645ee1b 100644 (file)
@@ -709,6 +709,9 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                } else if (strcmp(token, "nodiscard") == 0) {
                        ctx->options &= ~E2F_OPT_DISCARD;
                        continue;
+               } else if (strcmp(token, "no_optimize_extents") == 0) {
+                       ctx->options |= E2F_OPT_NOOPT_EXTENTS;
+                       continue;
                } else if (strcmp(token, "log_filename") == 0) {
                        if (!arg)
                                extended_usage++;
@@ -1007,6 +1010,11 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
        if (c)
                verbose = 1;
 
+       profile_get_boolean(ctx->profile, "options", "no_optimize_extents",
+                           0, 0, &c);
+       if (c)
+               ctx->options |= E2F_OPT_NOOPT_EXTENTS;
+
        if (ctx->readahead_kb == ~0ULL) {
                profile_get_integer(ctx->profile, "options",
                                    "readahead_mem_pct", 0, -1, &c);