#define OBD_FAIL_RAND 0x08000000 /* fail 1/N of the time */
#define OBD_FAIL_USR1 0x04000000 /* user flag */
-static inline int obd_fail_check(__u32 id)
-{
- static int count = 0;
- if (likely((obd_fail_loc & OBD_FAIL_MASK_LOC) !=
- (id & OBD_FAIL_MASK_LOC)))
- return 0;
-
- if ((obd_fail_loc & (OBD_FAILED | OBD_FAIL_ONCE)) ==
- (OBD_FAILED | OBD_FAIL_ONCE)) {
- count = 0; /* paranoia */
- return 0;
- }
-
- if (obd_fail_loc & OBD_FAIL_RAND) {
- unsigned int ll_rand(void);
- if (obd_fail_val < 2)
- return 0;
- if (ll_rand() % obd_fail_val > 0)
- return 0;
- }
-
- if (obd_fail_loc & OBD_FAIL_SKIP) {
- count++;
- if (count < obd_fail_val)
- return 0;
- count = 0;
- }
-
- /* Overridden by FAIL_ONCE */
- if (obd_fail_loc & OBD_FAIL_SOME) {
- count++;
- if (count >= obd_fail_val) {
- count = 0;
- /* Don't fail anymore */
- obd_fail_loc |= OBD_FAIL_ONCE;
- }
- }
-
- obd_fail_loc |= OBD_FAILED;
- /* Handle old checks that OR in this */
- if (id & OBD_FAIL_ONCE)
- obd_fail_loc |= OBD_FAIL_ONCE;
-
- return 1;
-}
-
+int obd_fail_check(__u32 id);
#define OBD_FAIL_CHECK(id) \
({ \
int _ret_ = 0; \
EXPORT_SYMBOL(obd_fail_loc);
EXPORT_SYMBOL(obd_alloc_fail_rate);
EXPORT_SYMBOL(obd_fail_val);
+
+int obd_fail_check(__u32 id)
+{
+ static int count = 0;
+ if (likely((obd_fail_loc & OBD_FAIL_MASK_LOC) !=
+ (id & OBD_FAIL_MASK_LOC)))
+ return 0;
+
+ if ((obd_fail_loc & (OBD_FAILED | OBD_FAIL_ONCE)) ==
+ (OBD_FAILED | OBD_FAIL_ONCE)) {
+ count = 0; /* paranoia */
+ return 0;
+ }
+
+ if (obd_fail_loc & OBD_FAIL_RAND) {
+ unsigned int ll_rand(void);
+ if (obd_fail_val < 2)
+ return 0;
+ if (ll_rand() % obd_fail_val > 0)
+ return 0;
+ }
+
+ if (obd_fail_loc & OBD_FAIL_SKIP) {
+ count++;
+ if (count < obd_fail_val)
+ return 0;
+ count = 0;
+ }
+
+ /* Overridden by FAIL_ONCE */
+ if (obd_fail_loc & OBD_FAIL_SOME) {
+ count++;
+ if (count >= obd_fail_val) {
+ count = 0;
+ /* Don't fail anymore */
+ obd_fail_loc |= OBD_FAIL_ONCE;
+ }
+ }
+
+ obd_fail_loc |= OBD_FAILED;
+ /* Handle old checks that OR in this */
+ if (id & OBD_FAIL_ONCE)
+ obd_fail_loc |= OBD_FAIL_ONCE;
+
+ return 1;
+}
+EXPORT_SYMBOL(obd_fail_check);