* Mike Belopuhov <m...@crypt.org.ru> [120404 17:51]: > i agree that this is a great find. i don't really like the diff though. > i see no point in introducing this macro. what do others think?
Your diff looks better to me. > Index: msdosfs/denode.h > =================================================================== > RCS file: /cvs/src/sys/msdosfs/denode.h,v > retrieving revision 1.23 > diff -u -p -r1.23 denode.h > --- msdosfs/denode.h 17 Jul 2010 19:27:07 -0000 1.23 > +++ msdosfs/denode.h 4 Apr 2012 12:20:23 -0000 > @@ -116,10 +116,11 @@ struct fatcache { > * cache is probably pretty worthless if a file is opened by multiple > * processes. > */ > -#define FC_SIZE 2 /* number of entries in the cache */ > +#define FC_SIZE 3 /* number of entries in the cache */ > #define FC_LASTMAP 0 /* entry the last call to pcbmap() > resolved > * to */ > #define FC_LASTFC 1 /* entry for the last cluster in the > file */ > +#define FC_OLASTFC 2 /* entry for the previous last cluster > */ > > #define FCE_EMPTY 0xffffffff /* doesn't represent an actual > cluster # */ > > Index: msdosfs/msdosfs_fat.c > =================================================================== > RCS file: /cvs/src/sys/msdosfs/msdosfs_fat.c,v > retrieving revision 1.22 > diff -u -p -r1.22 msdosfs_fat.c > --- msdosfs/msdosfs_fat.c 4 Jul 2011 04:30:41 -0000 1.22 > +++ msdosfs/msdosfs_fat.c 4 Apr 2012 12:20:26 -0000 > @@ -952,6 +952,13 @@ extendfile(struct denode *dep, uint32_t > return (error); > } > > + /* > + * Preserve value for the last cluster before extending the file > + * to speed up further lookups. > + */ > + fc_setcache(dep, FC_OLASTFC, dep->de_fc[FC_LASTFC].fc_frcn, > + dep->de_fc[FC_LASTFC].fc_fsrcn); > + > while (count > 0) { > /* > * Allocate a new cluster chain and cat onto the end of the -- Alexander Polakov | plhk.ru