diff options
-rw-r--r-- | sys/fs/msdosfs/msdosfs_fat.c | 9 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfsmount.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index e2e6061..c0b53a4 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 f7f2dff..f3c08d6 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) */ |