From: Namjae Jeon Date: Thu, 29 Nov 2012 03:18:51 +0000 (+1100) Subject: fat: notify when discard is not supported X-Git-Tag: next-20121205~1^2~100 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0a20780e543f8151869c6dacd4265389fb0691f5;p=karo-tx-linux.git fat: notify when discard is not supported Change fatfs so that a warning is emitted when an attempt is made to mount a filesystem with the unsupported `discard' option. ext4 aready does this: http://patchwork.ozlabs.org/patch/192668/ Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat Acked-by: OGAWA Hirofumi Signed-off-by: Andrew Morton --- diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 5bafaad00530..7b186a5d51b1 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "fat.h" @@ -1431,6 +1432,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, goto out_fail; } + if (sbi->options.discard) { + struct request_queue *q = bdev_get_queue(sb->s_bdev); + if (!blk_queue_discard(q)) + fat_msg(sb, KERN_WARNING, + "mounting with \"discard\" option, but " + "the device does not support discard"); + } + return 0; out_invalid: