1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Back out [05c9832e5f6eb] since it was causing a performance regression with

no obvious benefit.

FossilOrigin-Name: 639cc85a911454bffdcccb33f2976c683953ae64
This commit is contained in:
drh
2011-08-29 11:56:14 +00:00
5 changed files with 21 additions and 18 deletions

View File

@@ -3445,19 +3445,13 @@ static int proxyFileControl(sqlite3_file*,int,void*);
** nBytes or larger, this routine is a no-op.
*/
static int fcntlSizeHint(unixFile *pFile, i64 nByte){
{ /* preserve indentation of removed "if" */
if( pFile->szChunk ){
i64 nSize; /* Required file size */
i64 szChunk; /* Chunk size */
struct stat buf; /* Used to hold return values of fstat() */
if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT;
szChunk = pFile->szChunk;
if( szChunk==0 ){
nSize = nByte;
}else{
nSize = ((nByte+szChunk-1) / szChunk) * szChunk;
}
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
if( nSize>(i64)buf.st_size ){
#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE