various changes from sm4 and sm-ssc (svn); see updated changelog for the full information

This commit is contained in:
AJ Kelly
2010-02-18 23:17:24 -06:00
parent f9bfc80fa9
commit 5c5ef54a48
26 changed files with 436 additions and 260 deletions
+22
View File
@@ -22,6 +22,26 @@ void RageFileManagerReadAhead::ReadAhead( RageFileBasic *pFile, int iBytes )
posix_fadvise( iFD, iStart, iBytes, POSIX_FADV_WILLNEED );
}
void RageFileManagerReadAhead::DiscardCache( RageFileBasic *pFile, int iRelativePosition, int iBytes )
{
int iFD = pFile->GetFD();
if( iFD == -1 )
return;
int iStart = lseek( iFD, 0, SEEK_CUR );
iStart += iRelativePosition;
if( iStart < 0 )
{
iBytes -= iStart;
iStart = 0;
}
if( iBytes == 0 )
return;
posix_fadvise( iFD, iStart, iBytes, POSIX_FADV_DONTNEED );
}
#else
#if 0
/* This doesn't currently work, because dup() locks the file position of the new FD with the old
@@ -123,10 +143,12 @@ void RageFileManagerReadAhead::ReadAhead( RageFileBasic *pFile, int iBytes )
}
}
}
void RageFileManagerReadAhead::DiscardCache( RageFileBasic *pFile, int iRelativePosition, int iBytes ) { }
#else
void RageFileManagerReadAhead::Init() { }
void RageFileManagerReadAhead::Shutdown() { }
void RageFileManagerReadAhead::ReadAhead( RageFileBasic *pFile, int iBytes ) { }
void RageFileManagerReadAhead::DiscardCache( RageFileBasic *pFile, int iRelativePosition, int iBytes ) { }
#endif
#endif