diff options
author | Lukas Czerner <lczerner@redhat.com> | 2011-09-15 23:55:23 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-15 23:55:23 -0400 |
commit | 765e03f0374b655ba99c0881aebf6c101098c282 (patch) | |
tree | 59c178b763ef4305f63a591a6a3747ad775a8874 | |
parent | 2fa1679adb2be88cddcdc98bed325ac0ce72ef93 (diff) | |
download | e2fsprogs-765e03f0374b655ba99c0881aebf6c101098c282.tar.gz |
e2fsck: do not attempt to discard if -n was specified
If '-n' option is specified there should be no changes made to the file
system hence we should not attempt to discard the file system. This
commit adds a check into the e2fsck_discard_blocks() condition so it skip
discard if E2F_OPT_NO flag is set.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/pass5.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c index f9d746c8..cf37556e 100644 --- a/e2fsck/pass5.c +++ b/e2fsck/pass5.c @@ -87,7 +87,8 @@ static void e2fsck_discard_blocks(e2fsck_t ctx, io_manager manager, if (ext2fs_test_changed(ctx->fs)) ctx->options &= ~E2F_OPT_DISCARD; - if ((ctx->options & E2F_OPT_DISCARD) && + if (!(ctx->options & E2F_OPT_NO) && + (ctx->options & E2F_OPT_DISCARD) && (io_channel_discard(fs->io, start, count))) ctx->options &= ~E2F_OPT_DISCARD; } @@ -331,11 +332,9 @@ redo_counts: if (first_free > i) first_free = i; } else { - if ((i > first_free) && - (ctx->options & E2F_OPT_DISCARD)) { + if (i > first_free) e2fsck_discard_blocks(ctx, manager, first_free, (i - first_free)); - } first_free = ext2fs_blocks_count(fs->super); } blocks ++; |