Skip to contentSkip to conversation

f2fs: notify when discard is not supported

PATCH In review Namjae Jeon 1 participant 1 message Mar 17, 2013

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

PATCH 1/5 f2fs: notify when discard is not supported

From: Namjae Jeon <[email protected]>

Change f2fs so that a warning is emitted when an attempt is made to mount a filesystem with the unsupported discard option.

---
 fs/f2fs/super.c |    9 +++++++++
 1 file changed, 9 insertions(+)
fs/f2fs/super.c +9 -0
index ae75536..2bb6951 100644
@@ -21,6 +21,7 @@
 #include <linux/seq_file.h>
 #include <linux/random.h>
 #include <linux/exportfs.h>
+#include <linux/blkdev.h>
 #include <linux/f2fs_fs.h>
 
 #include "f2fs.h"
@@ -649,6 +650,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	err = f2fs_build_stats(sbi);
 	if (err)
 		goto fail;
+
+	if (test_opt(sbi, DISCARD)) {
+		struct request_queue *q = bdev_get_queue(sb->s_bdev);
+		if (!blk_queue_discard(q))
+			f2fs_msg(sb, KERN_WARNING,
+					"mounting with \"discard\" option, but "
+					"the device does not support discard");
+	}
 
 	return 0;
 fail:
Signature · 1 line
1.7.9.5