aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/support/debug.c17
-rw-r--r--fs/xfs/support/debug.h2
-rw-r--r--fs/xfs/xfs_alloc.c2
-rw-r--r--fs/xfs/xfs_error.c2
4 files changed, 3 insertions, 20 deletions
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index 08bbd3cb87ae..f45a49ffd3a3 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -81,20 +81,3 @@ assfail(char *expr, char *file, int line)
81 printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line); 81 printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line);
82 BUG(); 82 BUG();
83} 83}
84
85#if ((defined(DEBUG) || defined(INDUCE_IO_ERRROR)) && !defined(NO_WANT_RANDOM))
86unsigned long random(void)
87{
88 static unsigned long RandomValue = 1;
89 /* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
90 register long rv = RandomValue;
91 register long lo;
92 register long hi;
93
94 hi = rv / 127773;
95 lo = rv % 127773;
96 rv = 16807 * lo - 2836 * hi;
97 if (rv <= 0) rv += 2147483647;
98 return RandomValue = rv;
99}
100#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
index 2a70cc605ae3..a27a7c8c0526 100644
--- a/fs/xfs/support/debug.h
+++ b/fs/xfs/support/debug.h
@@ -50,7 +50,7 @@ extern void assfail(char *expr, char *f, int l);
50#else /* DEBUG */ 50#else /* DEBUG */
51 51
52# define ASSERT(expr) ASSERT_ALWAYS(expr) 52# define ASSERT(expr) ASSERT_ALWAYS(expr)
53extern unsigned long random(void); 53# include <linux/random.h>
54 54
55#ifndef STATIC 55#ifndef STATIC
56# define STATIC noinline 56# define STATIC noinline
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index e80dda3437d1..8e9a40aa0cd3 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -764,7 +764,7 @@ xfs_alloc_ag_vextent_near(
764 */ 764 */
765 int dofirst; /* set to do first algorithm */ 765 int dofirst; /* set to do first algorithm */
766 766
767 dofirst = random() & 1; 767 dofirst = random32() & 1;
768#endif 768#endif
769 /* 769 /*
770 * Get a cursor for the by-size btree. 770 * Get a cursor for the by-size btree.
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index b1af54464f00..8c4331631337 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -80,7 +80,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
80 int i; 80 int i;
81 int64_t fsid; 81 int64_t fsid;
82 82
83 if (random() % randfactor) 83 if (random32() % randfactor)
84 return 0; 84 return 0;
85 85
86 memcpy(&fsid, fsidp, sizeof(xfs_fsid_t)); 86 memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));