When Move()ing, Remove()ing, or Close()ing a file opened for writing, update the cache when possible (RageFileDriverDirect) or invalidate the directory cache for the directory containing that file (everything else). Remove most of the FlushDirCache() calls as they are no longer needed. This fixes a long standing bug where files added into the cache were stat(2)ed O(n^2) times--that is, each file is stat(2)ed O(n) times.
This commit is contained in:
@@ -935,8 +935,6 @@ bool Profile::SaveAllToDir( RString sDir, bool bSignData ) const
|
||||
FILEMAN->CreateDir( sDir + EDIT_COURSES_SUBDIR );
|
||||
FILEMAN->CreateDir( sDir + SCREENSHOTS_SUBDIR );
|
||||
|
||||
FILEMAN->FlushDirCache( sDir );
|
||||
|
||||
return bSaved;
|
||||
}
|
||||
|
||||
@@ -998,17 +996,11 @@ bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const
|
||||
}
|
||||
}
|
||||
|
||||
// Update file cache, or else IsAFile in CryptManager won't see this new file.
|
||||
FILEMAN->FlushDirCache( sDir );
|
||||
|
||||
if( bSignData )
|
||||
{
|
||||
RString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
|
||||
CryptManager::SignFileToFile(fn, sStatsXmlSigFile);
|
||||
|
||||
// Update file cache, or else IsAFile in CryptManager won't see sStatsXmlSigFile.
|
||||
FILEMAN->FlushDirCache( sDir );
|
||||
|
||||
// Save the "don't share" file
|
||||
RString sDontShareFile = sDir + DONT_SHARE_SIG;
|
||||
CryptManager::SignFileToFile(sStatsXmlSigFile, sDontShareFile);
|
||||
@@ -1815,7 +1807,6 @@ RString Profile::MakeUniqueFileNameNoExtension( RString sDir, RString sFileNameB
|
||||
//
|
||||
// Find a file name for the screenshot
|
||||
//
|
||||
FILEMAN->FlushDirCache( sDir );
|
||||
|
||||
vector<RString> files;
|
||||
GetDirListing( sDir + sFileNameBeginning+"*", files, false, false );
|
||||
|
||||
Reference in New Issue
Block a user