userlibandfileserver/fileserver/sfile/sf_file_cache.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
--- a/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp	Tue Aug 31 16:34:26 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp	Wed Sep 01 12:34:56 2010 +0100
@@ -32,10 +32,6 @@
 #include "sf_cache_client.h"
 #include "sf_file_cache_defs.h"
 
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "sf_file_cacheTraces.h"
-#endif
-
 
 // disables flushing of stale cachelines before each write
 #define LAZY_WRITE
@@ -84,10 +80,6 @@
 
 const TInt KMinSequentialReadsBeforeReadAhead = 3;
 
-#ifdef DOUBLE_BUFFERED_WRITING
-const TInt KMinSequentialAppendsBeforeFlush = 3;
-#endif
-
 //************************************
 // CFileCache
 //************************************
@@ -1171,18 +1163,6 @@
 					currentPos = iSize64;
 				iInitialSize = iSize64;
 
-
-#ifdef DOUBLE_BUFFERED_WRITING
-				// count the number of sequential write-appends
-				if (currentOperation->iClientRequest)
-					{
-					if (currentPos == iSize64)
-						iSequentialAppends++;
-					else
-						iSequentialAppends = 0;
-					}
-#endif // DOUBLE_BUFFERED_WRITING
-
 				// if EFileWriteDirectIO OR 
 				// (caching writes and requested write len > size of the cache), 
 				// flush the write cache
@@ -1291,13 +1271,6 @@
 						lastError = r;
 					}
 #endif
-#ifdef DOUBLE_BUFFERED_WRITING
-				if (cachingWrites && lastError == KErrNone && 
-					iSequentialAppends >= KMinSequentialAppendsBeforeFlush && iCacheClient->LockedSegmentsHalfUsed())
-					{
-					DoFlushDirty(aNewRequest, &aMsgRequest, EFlushHalf);
-					}
-#endif
 				// if no cacheline found & write caching is enabled, allocate a new cacheline
 				if (cachingWrites && addr == NULL && lastError == KErrNone)
 					{
@@ -1630,13 +1603,17 @@
 
 void CFileCache::PropagateFlushErrorToAllFileShares()
 	{
-	ASSERT(IsDriveThread());
-	TDblQueIter<CFileShare> fileShareIter(iFileCB->FileShareList());
-	CFileShare* pFileShare;
-	while ((pFileShare = fileShareIter++) != NULL)
+	FileShares->Lock();
+	TInt count = FileShares->Count();
+	while(count--)
 		{
-		pFileShare->iFlushError = iFlushError;
+		CFileShare* share = (CFileShare*)(*FileShares)[count];
+		if (&share->File() == iFileCB)
+			{
+			share->iFlushError = iFlushError;
+			}
 		}
+	FileShares->Unlock();
 	}
 
 /**
@@ -1838,7 +1815,7 @@
 
 #ifdef SETSIZE_BEFORE_WRITE	
 				TInt64 physicalFileSize = iFileCB->Size64();
-				if ((pos + (TInt64) len) > physicalFileSize)
+				if ( (!iDrive->IsRugged()) && ((pos + (TInt64) len) > physicalFileSize))
 					{
 					// Need to switch to drive thread before calling CFileCB::SetSizeL()
 					if (!IsDriveThread())
@@ -1956,12 +1933,6 @@
 					case EFlushSingle:
 						currentOperation->iState = EStEnd;
 						break;
-					case EFlushHalf:
-						if (iCacheClient->LockedSegmentsHalfUsed())
-							currentOperation->iState = EStWriteToDisk;
-						else
-							currentOperation->iState = EStEnd;
-						break;
 					case EFlushAll:
 						currentOperation->iState = EStWriteToDisk;
 						break;
@@ -2063,11 +2034,11 @@
 			// However if the write error is to the bootsector remounting will always fail because the boot
 			// sector will have changed and hence the disk is useless.
 			// 
-			OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT2, "drive %d", DriveNumber());
+			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMount, EF32TraceUidFileSys, DriveNumber());
 
 			TInt remountSuccess = iDrive->ReMount(*iMount);
 
-			OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT2RET, "success %d", remountSuccess);
+			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMountRet, EF32TraceUidFileSys, remountSuccess);
 			if (!remountSuccess)
 				continue;