linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: add fallocate mode blocking for debugging purposes
@ 2014-04-13 20:21 Theodore Ts'o
  2014-04-13 22:00 ` Theodore Ts'o
  0 siblings, 1 reply; 14+ messages in thread
From: Theodore Ts'o @ 2014-04-13 20:21 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Namjae Jeon, Theodore Ts'o

If a particular fallocate mode is causing test failures, give the
tester the ability to block a particular fallocate mode so that the
use of a particular fallocate mode will be reported as not supported.

For example, if the COLLAPSE_RANGE fallocate mode is causing test
failures, this allows us to suppress it so we can more easily test the
rest of the file system code.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/extents.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 64b4003..1bb3e4b 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -29,6 +29,7 @@
  *   - smart tree reduction
  */
 
+#include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/time.h>
 #include <linux/jbd2.h>
@@ -4862,6 +4863,12 @@ out_mutex:
 	return ret;
 }
 
+int ext4_fallocate_mode_block __read_mostly;
+
+module_param_named(fallocate_mode_block, ext4_fallocate_mode_block, int, 0644);
+MODULE_PARM_DESC(fallocate_mode_block,
+		 "Fallocate modes which are blocked for debugging purposes");
+
 /*
  * preallocate space for a file. This implements ext4's fallocate file
  * operation, which gets called from sys_fallocate system call.
@@ -4881,6 +4888,13 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	struct timespec tv;
 	unsigned int blkbits = inode->i_blkbits;
 
+	/*
+	 * for debugging purposes, allow certain fallocate operations
+	 * to be disabled
+	 */
+	if (unlikely(mode & ext4_fallocate_mode_block))
+		return -EOPNOTSUPP;
+
 	/* Return error if mode is not supported */
 	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
 		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-04-16 16:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-13 20:21 [PATCH] ext4: add fallocate mode blocking for debugging purposes Theodore Ts'o
2014-04-13 22:00 ` Theodore Ts'o
2014-04-14 14:05   ` Namjae Jeon
2014-04-16 16:05     ` Lukáš Czerner
2014-04-15 16:02   ` Lukáš Czerner
2014-04-15 16:15     ` Eric Sandeen
2014-04-15 18:44       ` Theodore Ts'o
2014-04-15 19:13         ` Eric Sandeen
2014-04-15 22:32         ` Eric Sandeen
2014-04-15 23:30           ` Theodore Ts'o
2014-04-16  0:06             ` Dave Chinner
2014-04-16  5:47               ` Theodore Ts'o
2014-04-15 23:25         ` Dave Chinner
2014-04-16  0:23           ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).