Use random() rather then than homegrown stuff.

This commit is contained in:
Poul-Henning Kamp 1998-04-06 11:39:04 +00:00
parent 8184a0a4d1
commit 7cd5051bec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35063
2 changed files with 6 additions and 22 deletions

View file

@ -1,4 +1,4 @@
/* $Id: msdosfs_fat.c,v 1.18 1998/02/20 13:11:49 bde Exp $ */
/* $Id: msdosfs_fat.c,v 1.19 1998/03/28 07:22:03 ache Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.28 1997/11/17 15:36:49 ws Exp $ */
/*-
@ -787,22 +787,14 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
if (start) {
if ((len = chainlength(pmp, start, count)) >= count)
return (chainalloc(pmp, start, count, fillwith, retcluster, got));
} else {
/*
* This is a new file, initialize start
*/
struct timeval tv;
microtime(&tv);
start = (tv.tv_usec >> 10) | tv.tv_usec;
} else
len = 0;
}
/*
* Start at a (pseudo) random place to maximize cluster runs
* under multiple writers.
*/
newst = (start * 1103515245 + 12345) % (pmp->pm_maxcluster + 1);
newst = random() % (pmp->pm_maxcluster + 1);
foundl = 0;
for (cn = newst; cn <= pmp->pm_maxcluster;) {

View file

@ -1,4 +1,4 @@
/* $Id: msdosfs_fat.c,v 1.18 1998/02/20 13:11:49 bde Exp $ */
/* $Id: msdosfs_fat.c,v 1.19 1998/03/28 07:22:03 ache Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.28 1997/11/17 15:36:49 ws Exp $ */
/*-
@ -787,22 +787,14 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
if (start) {
if ((len = chainlength(pmp, start, count)) >= count)
return (chainalloc(pmp, start, count, fillwith, retcluster, got));
} else {
/*
* This is a new file, initialize start
*/
struct timeval tv;
microtime(&tv);
start = (tv.tv_usec >> 10) | tv.tv_usec;
} else
len = 0;
}
/*
* Start at a (pseudo) random place to maximize cluster runs
* under multiple writers.
*/
newst = (start * 1103515245 + 12345) % (pmp->pm_maxcluster + 1);
newst = random() % (pmp->pm_maxcluster + 1);
foundl = 0;
for (cn = newst; cn <= pmp->pm_maxcluster;) {