Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7a23a9b authored by Joe Perches's avatar Joe Perches Committed by Tim Shimmin
Browse files

[XFS] reducing the number of random number functions.



Patch provided by Joe Perches

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

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent e9ed9d22
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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));