Backed out changeset e72707266b4a because of orange on Win Debug. a=backout
authorMounir Lamouri <mounir.lamouri@gmail.com>
Thu, 21 Oct 2010 15:16:34 +0200
changeset 56304 dcbc869144d4b5f0432473f94b171a868b3e804a
parent 56301 e72707266b4aabf7e9e894defd9828b9deb0196e
child 56305 b206601bf528afab90df2791d94ea86b8e92911b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbackout
milestone2.0b8pre
backs oute72707266b4aabf7e9e894defd9828b9deb0196e
Backed out changeset e72707266b4a because of orange on Win Debug. a=backout
netwerk/cache/nsDiskCacheMap.h
netwerk/cache/nsDiskCacheStreams.cpp
xpcom/glue/FileUtils.cpp
--- a/netwerk/cache/nsDiskCacheMap.h
+++ b/netwerk/cache/nsDiskCacheMap.h
@@ -89,19 +89,16 @@ struct nsDiskCacheEntry;
 // Min and max values for the number of records in the DiskCachemap
 #define kMinRecordCount    512
 
 #define kSeparateFile      0
 // #define must always  be <= 65535KB, or overflow. See bug 443067 Comment 8
 #define kMaxDataFileSize   5 * 1024 * 1024  // 5 MB (in bytes) 
 #define kBuckets           (1 << 5)    // must be a power of 2!
 
-// preallocate up to 1MB of separate cache file
-#define kPreallocateLimit  1 * 1024 * 1024
-
 class nsDiskCacheRecord {
 
 private:
     PRUint32    mHashNumber;
     PRUint32    mEvictionRank;
     PRUint32    mDataLocation;
     PRUint32    mMetaLocation;
  
--- a/netwerk/cache/nsDiskCacheStreams.cpp
+++ b/netwerk/cache/nsDiskCacheStreams.cpp
@@ -38,17 +38,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsDiskCache.h"
 #include "nsDiskCacheDevice.h"
 #include "nsDiskCacheStreams.h"
 #include "nsCacheService.h"
-#include "mozilla/FileUtils.h"
 
 
 
 // Assumptions:
 //      - cache descriptors live for life of streams
 //      - streams will only be used by FileTransport,
 //         they will not be directly accessible to clients
 //      - overlapped I/O is NOT supported
@@ -724,20 +723,16 @@ nsDiskCacheStreamIO::FlushBufferToFile()
             rv = cacheMap->DeleteStorage(record, nsDiskCache::kData);
             if (NS_FAILED(rv))  return rv;
         }
         record->SetDataFileGeneration(mBinding->mGeneration);
         
         // allocate file
         rv = OpenCacheFile(PR_RDWR | PR_CREATE_FILE, &mFD);
         if (NS_FAILED(rv))  return rv;
-
-        PRInt64 dataSize = mBinding->mCacheEntry->PredictedDataSize();
-        if (dataSize != -1)
-            mozilla::fallocate(mFD, PR_MIN(dataSize, kPreallocateLimit));
     }
     
     // write buffer
     PRInt32 bytesWritten = PR_Write(mFD, mBuffer, mBufEnd);
     if (PRUint32(bytesWritten) != mBufEnd) {
         NS_WARNING("failed to flush all data");
         return NS_ERROR_UNEXPECTED;     // NS_ErrorAccordingToNSPR()
     }
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -42,22 +42,20 @@
 #include <sys/stat.h>
 #elif defined(XP_WIN)
 #include <windows.h>
 #endif
 
 #include "nscore.h"
 #include "private/pprio.h"
 #include "mozilla/FileUtils.h"
-#include "mozilla/FunctionTimer.h"
 
 bool 
 mozilla::fallocate(PRFileDesc *aFD, PRInt64 aLength) 
 {
-  NS_TIME_FUNCTION;
 #if defined(HAVE_POSIX_FALLOCATE)
   return posix_fallocate(PR_FileDesc2NativeHandle(aFD), 0, aLength) == 0;
 #elif defined(XP_WIN)
   return PR_Seek64(aFD, aLength, PR_SEEK_SET) == aLength
     && 0 != SetEndOfFile((HANDLE)PR_FileDesc2NativeHandle(aFD));
 #elif defined(XP_MACOSX)
   int fd = PR_FileDesc2NativeHandle(aFD);
   fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength};