]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix clobbering of the fatchain cache for clustered i/o's when full
authorBruce Evans <bde@FreeBSD.org>
Fri, 21 Dec 2018 21:17:45 +0000 (21:17 +0000)
committerBruce Evans <bde@FreeBSD.org>
Fri, 21 Dec 2018 21:17:45 +0000 (21:17 +0000)
commit416e232cc6d1b5a198023be3602296f582768839
tree7581e2e93ea7d586c6aa8cb16e48a0fb10773125
parent6c5c0137a932c376bd34f34614ba66fbe4691fdb
Fix clobbering of the fatchain cache for clustered i/o's when full
clustering is not done.  The bug caused extreme slowness for large
files in some cases.

There is no way to tell VOP_BMAP() how many blocks are wanted, so for
all file systems it has to waste time in some cases by searching for
more contiguous blocks than will be accessed.  For msdosfs, it also
clobbered the fatchain cache in these cases by advancing the cache to
point to the chain entry for block that won't be read.  This makes
the cache useless for the next sequential i/o (or VOP_BMAP()), so the
fat chain is searched from the beginning.  The cache only has 1 relevant
entry, so it is similarly useless for random i/o.

Fix this by only advancing the cache to point to the chain entry for
the first block that will be read.  Clustering uses results from
VOP_BMAP(), so when more than 1 block is read by clustering, the cache
is not advanced as optimally as before, but it is at most 1 cluster
size behind and searching the chain through the blocks for this cluster
doesn't take too long.
sys/fs/msdosfs/msdosfs_vnops.c