Skip to content

Commit f562146

Browse files
namjaejeontorvalds
authored andcommitted
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 <linkinjeon@gmail.com> Signed-off-by: Amit Sahrawat <amit.sahrawat83@gmail.com> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6920d99 commit f562146

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎fs/fat/inode.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/writeback.h>
2727
#include <linux/log2.h>
2828
#include <linux/hash.h>
29+
#include <linux/blkdev.h>
2930
#include <asm/unaligned.h>
3031
#include "fat.h"
3132

@@ -1431,6 +1432,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
14311432
goto out_fail;
14321433
}
14331434

1435+
if (sbi->options.discard) {
1436+
struct request_queue *q = bdev_get_queue(sb->s_bdev);
1437+
if (!blk_queue_discard(q))
1438+
fat_msg(sb, KERN_WARNING,
1439+
"mounting with \"discard\" option, but "
1440+
"the device does not support discard");
1441+
}
1442+
14341443
return 0;
14351444

14361445
out_invalid:

0 commit comments

Comments
 (0)