summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs/msdosfs_fat.c
diff options
context:
space:
mode:
authortrhodes <trhodes@FreeBSD.org>2007-01-16 23:43:14 +0000
committertrhodes <trhodes@FreeBSD.org>2007-01-16 23:43:14 +0000
commit317819a5f62502c2daad8b2f578f62e1cd7f4017 (patch)
tree938e2f8802f8611f8eddb5688d22683c2de30c63 /sys/fs/msdosfs/msdosfs_fat.c
parentd4434aa6e90019d12652d4a92904d14ca5765d53 (diff)
downloadFreeBSD-src-317819a5f62502c2daad8b2f578f62e1cd7f4017.zip
FreeBSD-src-317819a5f62502c2daad8b2f578f62e1cd7f4017.tar.gz
Add a 3rd entry in the cache, which keeps the end position
from just before extending a file. This has the desired effect of keeping the write speed constant. And yes, that helps a lot copying large files always at full speed now, and I have seen improvements using benchmarks/bonnie. Stolen from: NetBSD Reviewed by: bde
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_fat.c')
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index 31cf977..1d57a9c 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -79,6 +79,8 @@ static int fc_bmapcalls; /* # of times pcbmap was called */
static int fc_lmdistance[LMMAX];/* counters for how far off the last
* cluster mapped entry was. */
static int fc_largedistance; /* off by more than LMMAX */
+static int fc_wherefrom, fc_whereto, fc_lastclust;
+static int pm_fatblocksize;
static int chainalloc(struct msdosfsmount *pmp, u_long start,
u_long count, u_long fillwith, u_long *retcluster,
@@ -119,6 +121,7 @@ fatblock(pmp, ofs, bnp, sizep, bop)
*sizep = size;
if (bop)
*bop = ofs % pmp->pm_fatblocksize;
+ pm_fatblocksize = pmp->pm_fatblocksize;
}
/*
@@ -210,9 +213,12 @@ pcbmap(dep, findcn, bnp, cnp, sp)
*/
i = 0;
fc_lookup(dep, findcn, &i, &cn);
- if ((bn = findcn - i) >= LMMAX)
+ if ((bn = findcn - i) >= LMMAX) {
fc_largedistance++;
- else
+ fc_wherefrom = i;
+ fc_whereto = findcn;
+ fc_lastclust = dep->de_fc[FC_LASTFC].fc_frcn;
+ } else
fc_lmdistance[bn]++;
/*
@@ -1025,6 +1031,7 @@ extendfile(dep, count, bpp, ncp, flags)
return (error);
}
+ fc_last_to_nexttolast(dep);
while (count > 0) {
/*
* Allocate a new cluster chain and cat onto the end of the
OpenPOWER on IntegriCloud