From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger@dilger.ca, Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 4/5 v2] e2fsck: do not attempt to discard if -n was specified
Date: Fri, 12 Aug 2011 18:42:59 +0200 [thread overview]
Message-ID: <1313167380-3283-4-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1313167380-3283-1-git-send-email-lczerner@redhat.com>
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>
---
v2: This is the actually the first version of the patch
e2fsck/pass5.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index f9d746c..cf37556 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 ++;
--
1.7.4.4
next prev parent reply other threads:[~2011-08-12 16:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 16:42 [PATCH 1/5 v2] e2fsprogs: create open() and stat() helpers Lukas Czerner
2011-08-12 16:42 ` [PATCH 2/5 v2] e2fsprogs: Use punch hole as "discard" on regular files Lukas Czerner
2011-09-16 3:50 ` Ted Ts'o
2011-08-12 16:42 ` [PATCH 3/5 v2] configure.in: add check for linux/falloc.h header Lukas Czerner
2011-08-12 16:42 ` Lukas Czerner [this message]
2011-09-16 3:53 ` [PATCH 4/5 v2] e2fsck: do not attempt to discard if -n was specified Ted Ts'o
2011-08-12 16:43 ` [PATCH 5/5 v2] tests: Print out list of failed tests Lukas Czerner
2011-09-16 3:56 ` Ted Ts'o
2011-09-01 8:39 ` [PATCH 1/5 v2] e2fsprogs: create open() and stat() helpers Lukas Czerner
2011-09-16 3:50 ` Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313167380-3283-4-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=adilger@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).