Skip to contentSkip to conversation

fat: notify when discard is not supported

PATCH In review Namjae Jeon 2 participants 2 messages Nov 3, 2012 – Nov 5, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/3 fat: notify when discard is not supported

FAT also notify warning message about discard support as ext4(http://patchwork.ozlabs.org/patch/192668/)

---
 fs/fat/inode.c |    9 +++++++++
 1 file changed, 9 insertions(+)
fs/fat/inode.c +9 -0
index 8d79657..3b48bab 100644
@@ -26,6 +26,7 @@
 #include <linux/writeback.h>
 #include <linux/log2.h>
 #include <linux/hash.h>
+#include <linux/blkdev.h>
 #include <asm/unaligned.h>
 #include "fat.h"
 
@@ -1446,6 +1447,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:
Signature · 1 line
1.7.9.5
maintainer Acked-by on v2 2/3
#1 lore raw
Quoted 2 lines · Namjae Jeon

FAT also notify warning message about discard support as ext4(http://patchwork.ozlabs.org/patch/192668/)

Quoted 33 lines
---
 fs/fat/inode.c |    9 +++++++++
 1 file changed, 9 insertions(+)
fs/fat/inode.c +9 -0
index 8d79657..3b48bab 100644
@@ -26,6 +26,7 @@
 #include <linux/writeback.h>
 #include <linux/log2.h>
 #include <linux/hash.h>
+#include <linux/blkdev.h>
 #include <asm/unaligned.h>
 #include "fat.h"
 
@@ -1446,6 +1447,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:
Signature · 1 line
OGAWA Hirofumi <[email protected]>