aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2007-07-10 13:20:24 +0000
committerBruce Evans <bde@FreeBSD.org>2007-07-10 13:20:24 +0000
commit8e55bfaf4b42b44536c3f0cb0b12b122245891e3 (patch)
tree64fa32913c046116c35480f7146483cbb1a0ff2e /sys/fs
parent920d0c826e6d046abba594f1a3006ac4e10a9cb5 (diff)
Notes
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c9
-rw-r--r--sys/fs/msdosfs/msdosfsmount.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index e2e6061fa52b..c0b53a4e367b 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -769,6 +769,9 @@ chainalloc(pmp, start, count, fillwith, retcluster, got)
*retcluster = start;
if (got)
*got = count;
+ pmp->pm_nxtfree = start + count;
+ if (pmp->pm_nxtfree > pmp->pm_maxcluster)
+ pmp->pm_nxtfree = CLUST_FIRST;
return (0);
}
@@ -806,11 +809,7 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
} else
len = 0;
- /*
- * Start at a (pseudo) random place to maximize cluster runs
- * under multiple writers.
- */
- newst = random() % (pmp->pm_maxcluster + 1);
+ newst = pmp->pm_nxtfree;
foundl = 0;
for (cn = newst; cn <= pmp->pm_maxcluster;) {
diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h
index f7f2dffc2f88..f3c08d647206 100644
--- a/sys/fs/msdosfs/msdosfsmount.h
+++ b/sys/fs/msdosfs/msdosfsmount.h
@@ -94,7 +94,7 @@ struct msdosfsmount {
u_long pm_fatsize; /* size of fat in bytes */
u_int32_t pm_fatmask; /* mask to use for fat numbers */
u_long pm_fsinfo; /* fsinfo block number */
- u_long pm_nxtfree; /* next free cluster in fsinfo block */
+ u_long pm_nxtfree; /* next place to search for a free cluster */
u_int pm_fatmult; /* these 2 values are used in fat */
u_int pm_fatdiv; /* offset computation */
u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */