From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, sandeen@redhat.com, Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 4/4] e2fsck: Do not discard itable if discard doen't zero data
Date: Mon, 5 Mar 2012 08:49:36 +0100 [thread overview]
Message-ID: <1330933776-2696-4-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1330933776-2696-1-git-send-email-lczerner@redhat.com>
We do not want to discard inode table if the underlying device does not
return zeros when reading non-provisioned blocks. The reason is that if
the inode table is not zeroed yet, then discard would not help us since
we would have to zero it anyway. In the case that inode table was
already zeroed, then the discard would cause subsequent reads to contain
non-deterministic data so we would not be able to assume that the inode
table was zeroed and we would need to zero it again, which does not
really make sense.
This commit adds check to prevent inode table from being discarded if
the discard does not zero data.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
e2fsck/pass5.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index 741e6dd..9e63037 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -116,7 +116,18 @@ static void e2fsck_discard_inodes(e2fsck_t ctx, int group,
ctx->options &= ~E2F_OPT_DISCARD;
}
- if (!(ctx->options & E2F_OPT_DISCARD))
+ /*
+ * Do not attempt to discard if E2F_OPT_DISCARD is not set. And also
+ * skip the discard on this group if discard does not zero data.
+ * The reason is that if the inode table is not zeroed discard would
+ * no help us since we need to zero it anyway, or if the inode table
+ * is zeroed then the read after discard would not be deterministic
+ * anyway and we would not be able to assume that this inode table
+ * was zeroed anymore so we would have to zero it again, which does
+ * not really make sense.
+ */
+ if (!(ctx->options & E2F_OPT_DISCARD) ||
+ !io_channel_discard_zeroes_data(fs->io))
return;
/*
--
1.7.4.4
next prev parent reply other threads:[~2012-03-05 7:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 7:49 [PATCH 1/4] e2fsck: Discard only unused parts of inode table Lukas Czerner
2012-03-05 7:49 ` [PATCH 2/4] e2fsck: Do not forget to discard last block group Lukas Czerner
2012-03-05 19:29 ` Eric Sandeen
2012-03-11 19:18 ` Ted Ts'o
2012-03-11 19:33 ` [PATCH 1/3] e2fsck: remove last argument from e2fsck_discard_blocks() Theodore Ts'o
2012-03-11 19:33 ` [PATCH 2/3] e2fsck: do not forget to discard last block group Theodore Ts'o
2012-03-12 7:31 ` Lukas Czerner
2012-03-11 19:33 ` [PATCH 3/3] e2fsck: optimize CPU usage in check_{block,inode}_bitmaps() Theodore Ts'o
2012-03-12 7:44 ` Lukas Czerner
2012-03-12 7:30 ` [PATCH 1/3] e2fsck: remove last argument from e2fsck_discard_blocks() Lukas Czerner
2012-03-05 7:49 ` [PATCH 3/4] e2fsck: Do not discard when in read only mode Lukas Czerner
2012-03-05 19:33 ` Eric Sandeen
2012-03-11 19:35 ` Ted Ts'o
2012-03-05 7:49 ` Lukas Czerner [this message]
2012-03-05 19:46 ` [PATCH 4/4] e2fsck: Do not discard itable if discard doen't zero data Eric Sandeen
2012-03-11 19:39 ` Ted Ts'o
2012-03-05 17:45 ` [PATCH 1/4] e2fsck: Discard only unused parts of inode table Eric Sandeen
2012-03-05 18:43 ` Lukas Czerner
2012-03-05 19:01 ` Eric Sandeen
2012-03-11 19:27 ` Ted Ts'o
2012-03-12 7:26 ` Lukas Czerner
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=1330933776-2696-4-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--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).