s390/pageattr: do a single TLB flush for change_page_attr
[linux-2.6/btrfs-unstable.git] / include / linux / fault-inject.h
blob3159a7dba034bed547a531b2dcd511b29a679e89
1 #ifndef _LINUX_FAULT_INJECT_H
2 #define _LINUX_FAULT_INJECT_H
4 #ifdef CONFIG_FAULT_INJECTION
6 #include <linux/types.h>
7 #include <linux/debugfs.h>
8 #include <linux/ratelimit.h>
9 #include <linux/atomic.h>
12 * For explanation of the elements of this struct, see
13 * Documentation/fault-injection/fault-injection.txt
15 struct fault_attr {
16 unsigned long probability;
17 unsigned long interval;
18 atomic_t times;
19 atomic_t space;
20 unsigned long verbose;
21 bool task_filter;
22 unsigned long stacktrace_depth;
23 unsigned long require_start;
24 unsigned long require_end;
25 unsigned long reject_start;
26 unsigned long reject_end;
28 unsigned long count;
29 struct ratelimit_state ratelimit_state;
30 struct dentry *dname;
33 #define FAULT_ATTR_INITIALIZER { \
34 .interval = 1, \
35 .times = ATOMIC_INIT(1), \
36 .require_end = ULONG_MAX, \
37 .stacktrace_depth = 32, \
38 .ratelimit_state = RATELIMIT_STATE_INIT_DISABLED, \
39 .verbose = 2, \
40 .dname = NULL, \
43 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
44 int setup_fault_attr(struct fault_attr *attr, char *str);
45 bool should_fail(struct fault_attr *attr, ssize_t size);
47 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
49 struct dentry *fault_create_debugfs_attr(const char *name,
50 struct dentry *parent, struct fault_attr *attr);
52 #else /* CONFIG_FAULT_INJECTION_DEBUG_FS */
54 static inline struct dentry *fault_create_debugfs_attr(const char *name,
55 struct dentry *parent, struct fault_attr *attr)
57 return ERR_PTR(-ENODEV);
60 #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
62 #endif /* CONFIG_FAULT_INJECTION */
64 #ifdef CONFIG_FAILSLAB
65 extern bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags);
66 #else
67 static inline bool should_failslab(size_t size, gfp_t gfpflags,
68 unsigned long flags)
70 return false;
72 #endif /* CONFIG_FAILSLAB */
74 #endif /* _LINUX_FAULT_INJECT_H */