]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[XFS] reducing the number of random number functions.
authorJoe Perches <joe@perches.com>
Tue, 8 May 2007 03:49:03 +0000 (13:49 +1000)
committerTim Shimmin <tes@sgi.com>
Tue, 8 May 2007 03:49:03 +0000 (13:49 +1000)
Patch provided by Joe Perches

SGI-PV: 961696
SGI-Modid: xfs-linux-melb:xfs-kern:28209a

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/support/debug.c
fs/xfs/support/debug.h
fs/xfs/xfs_alloc.c
fs/xfs/xfs_error.c

index 08bbd3cb87aefb055088902550405c49a92be228..f45a49ffd3a34907f6b1ca2aceaea7dce40e2133 100644 (file)
@@ -81,20 +81,3 @@ assfail(char *expr, char *file, int line)
        printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line);
        BUG();
 }
-
-#if ((defined(DEBUG) || defined(INDUCE_IO_ERRROR)) && !defined(NO_WANT_RANDOM))
-unsigned long random(void)
-{
-       static unsigned long    RandomValue = 1;
-       /* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
-       register long   rv = RandomValue;
-       register long   lo;
-       register long   hi;
-
-       hi = rv / 127773;
-       lo = rv % 127773;
-       rv = 16807 * lo - 2836 * hi;
-       if (rv <= 0) rv += 2147483647;
-       return RandomValue = rv;
-}
-#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
index 2a70cc605ae34b5298ed8e4ebd0a912d9153fd37..a27a7c8c05264c1e651e0c0651d9caa4eec64c7f 100644 (file)
@@ -50,7 +50,7 @@ extern void assfail(char *expr, char *f, int l);
 #else /* DEBUG */
 
 # define ASSERT(expr)  ASSERT_ALWAYS(expr)
-extern unsigned long random(void);
+# include <linux/random.h>
 
 #ifndef STATIC
 # define STATIC noinline
index e80dda3437d196345b0d19cded4cac518b4e0eda..8e9a40aa0cd3fec9c14ffa158730ef801d6f598a 100644 (file)
@@ -764,7 +764,7 @@ xfs_alloc_ag_vextent_near(
         */
        int             dofirst;        /* set to do first algorithm */
 
-       dofirst = random() & 1;
+       dofirst = random32() & 1;
 #endif
        /*
         * Get a cursor for the by-size btree.
index b1af54464f0078006146cc790d664a6989f68350..8c433163133734d5905741bf1226c128319e82ab 100644 (file)
@@ -80,7 +80,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
        int i;
        int64_t fsid;
 
-       if (random() % randfactor)
+       if (random32() % randfactor)
                return 0;
 
        memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));