From: Lukas Czerner Date: Thu, 8 Nov 2012 18:28:29 +0000 (-0500) Subject: ext4: notify when discard is not supported X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=79add3a3f795e688e35d5e703d5a8cfa8ef923ac;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ext4: notify when discard is not supported Notify user when mounting the file system with -o discard option, but the device does not support discard. Obviously we do not want to fail the mount or disable the options, because the underlying device might change in future even without file system remount. Reviewed-by: Carlos Maiolino Signed-off-by: Lukas Czerner Signed-off-by: "Theodore Ts'o" --- diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ea21231633eb..6729470ee1a4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4015,6 +4015,14 @@ no_journal: } #endif /* CONFIG_QUOTA */ + if (test_opt(sb, DISCARD)) { + struct request_queue *q = bdev_get_queue(sb->s_bdev); + if (!blk_queue_discard(q)) + ext4_msg(sb, KERN_WARNING, + "mounting with \"discard\" option, but " + "the device does not support discard"); + } + ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, *sbi->s_es->s_mount_opts ? "; " : "", orig_data);