Commit f562146a3daf6aa0bbf2a1bc4b6b7da031ed5dcd

Authored by Namjae Jeon
Committed by Linus Torvalds
1 parent 6920d996e3

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>

Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff

... ... @@ -26,6 +26,7 @@
26 26 #include <linux/writeback.h>
27 27 #include <linux/log2.h>
28 28 #include <linux/hash.h>
  29 +#include <linux/blkdev.h>
29 30 #include <asm/unaligned.h>
30 31 #include "fat.h"
31 32  
... ... @@ -1429,6 +1430,14 @@
1429 1430 if (!sb->s_root) {
1430 1431 fat_msg(sb, KERN_ERR, "get root inode failed");
1431 1432 goto out_fail;
  1433 + }
  1434 +
  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");
1432 1441 }
1433 1442  
1434 1443 return 0;