summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs/msdosfs_fat.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2007-09-23 14:49:32 +0000
committerbde <bde@FreeBSD.org>2007-09-23 14:49:32 +0000
commit5cdc06872e1ac2b6529e1182078d48fa6fe57ff0 (patch)
treeb66babbdb423b091f34d1b6ccc43efeeb9473cde /sys/fs/msdosfs/msdosfs_fat.c
parent27bd800e6102d0ef36527c31660508bdecdd1b1d (diff)
downloadFreeBSD-src-5cdc06872e1ac2b6529e1182078d48fa6fe57ff0.zip
FreeBSD-src-5cdc06872e1ac2b6529e1182078d48fa6fe57ff0.tar.gz
Remove some of the pessimizations involving writing the fsi sector.
All active fields in fsi are advisory/optional, so we shouldn't do extra work to make them valid at all times, but instead we write to the fsi too often (we still do), and we searched for a free cluster for fsinxtfree too often. This commit just removes the whole search and its results, so that we write out our in-core copy of fsinxtfree instead of writing a "fixed" copy and clobbering our in-core copy. This saves fixing 3 bugs: - off-by-1 error for the end of the search, resulting in fsinxtfree not actually being adjusted iff only the last cluster is free. - missing adjustment when no clusters are free. - off-by-many error for the start of the search. Starting the search at 0 instead of at (the in-core copy of) fsinxtfree did more than defeat the reasons for existence of fsinxtfree. fsinxtfree exists mainly to avoid having to start at 0 for just the first search per mount, but has the side effect of reducing bias towards allocating near cluster 0. The bias would normally only be generated by the first search per mount (if fsinxtfree is not supported), but since we also adjusted the in-core copy of fsinxtfree here, we were doing extra work to maximize the bias. Approved by: re (kensmith)
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_fat.c')
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index 6586710..fa8741c 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -353,22 +353,6 @@ updatefats(pmp, bp, fatbn)
* If we have an FSInfo block, update it.
*/
if (pmp->pm_fsinfo) {
- u_long cn = pmp->pm_nxtfree;
-
- if (pmp->pm_freeclustercount
- && (pmp->pm_inusemap[cn / N_INUSEBITS]
- & (1 << (cn % N_INUSEBITS)))) {
- /*
- * The cluster indicated in FSInfo isn't free
- * any longer. Got get a new free one.
- */
- for (cn = 0; cn < pmp->pm_maxcluster; cn += N_INUSEBITS)
- if (pmp->pm_inusemap[cn / N_INUSEBITS] != (u_int)-1)
- break;
- pmp->pm_nxtfree = cn
- + ffs(pmp->pm_inusemap[cn / N_INUSEBITS]
- ^ (u_int)-1) - 1;
- }
if (bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec,
NOCRED, &bpn) != 0) {
/*
OpenPOWER on IntegriCloud