From: "Darrick J. Wong" <djwong@us.ibm.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-ext4 <linux-ext4@vger.kernel.org>
Subject: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
Date: Thu, 2 Dec 2010 16:16:59 -0800 [thread overview]
Message-ID: <20101203001659.GI18195@tux1.beaverton.ibm.com> (raw)
If the user tries to enable write flushes with "barrier=1" and the underlying
block device does not support flushes, print a message and set barrier=0.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---
fs/ext4/super.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e32195d..098dcf0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3124,6 +3124,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
&journal_ioprio, NULL, 0))
goto failed_mount;
+ /* Catch barrier=1 and no flush support */
+ if (test_opt(sb, BARRIER) &&
+ !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) {
+ ext4_msg(sb, KERN_WARNING, "flush not supported; disabling.");
+ clear_opt(sbi->s_mount_opt, BARRIER);
+ }
+
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
@@ -4198,6 +4205,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
goto restore_opts;
}
+ /* Catch barrier=1 and no flush support */
+ if (test_opt(sb, BARRIER) &&
+ !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) {
+ ext4_msg(sb, KERN_WARNING, "flush not supported; disabling.");
+ clear_opt(sbi->s_mount_opt, BARRIER);
+ }
+
if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
ext4_abort(sb, "Abort forced by user");
next reply other threads:[~2010-12-03 0:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-03 0:16 Darrick J. Wong [this message]
2010-12-03 7:09 ` Christoph Hellwig
2010-12-03 9:14 ` Darrick J. Wong
2010-12-06 13:39 ` Christoph Hellwig
2010-12-06 18:09 ` Darrick J. Wong
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=20101203001659.GI18195@tux1.beaverton.ibm.com \
--to=djwong@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®