lkml.org 
[lkml]   [2010]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ext4: Set barrier=0 when block device does not advertise flush support
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");


\
 
 \ /
  Last update: 2010-12-03 01:19    [W:1.034 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site