userlibandfileserver/fileserver/sfile/sf_file_cache.cpp
changeset 131 e880629062dd
parent 0 a41df078684a
child 134 95847726fe57
equal deleted inserted replaced
130:c30940f6d922 131:e880629062dd
  1501 						CCacheManagerFactory::CacheManager()->Stats().iWriteThroughWithDirtyDataCount++;
  1501 						CCacheManagerFactory::CacheManager()->Stats().iWriteThroughWithDirtyDataCount++;
  1502 #endif
  1502 #endif
  1503 					// Need to reset currentOperation.iReadWriteArgs.iTotalLength here to make sure 
  1503 					// Need to reset currentOperation.iReadWriteArgs.iTotalLength here to make sure 
  1504 					// TFsFileWrite::PostInitialise() doesn't think there's no data left to process
  1504 					// TFsFileWrite::PostInitialise() doesn't think there's no data left to process
  1505 					aMsgRequest.ReStart();
  1505 					aMsgRequest.ReStart();
       
  1506 					
       
  1507 					//Need to preserve the current state otherwise if we are over the ram threshold 
       
  1508 					//the request can end up in a livelock trying to repeatedly flush.
       
  1509 					currentOperation->iState = EStWriteThrough;
       
  1510 					
  1506 					if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete)
  1511 					if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete)
  1507 						return r;
  1512 						return r;
  1508 					}
  1513 					}
  1509 
  1514 
  1510 				retCode = CFsRequest::EReqActionContinue;
  1515 				retCode = CFsRequest::EReqActionContinue;
  1592 	iLock.Signal();
  1597 	iLock.Signal();
  1593 	}
  1598 	}
  1594 
  1599 
  1595 void CFileCache::PropagateFlushErrorToAllFileShares()
  1600 void CFileCache::PropagateFlushErrorToAllFileShares()
  1596 	{
  1601 	{
  1597 	FileShares->Lock();
  1602 	ASSERT(IsDriveThread());
  1598 	TInt count = FileShares->Count();
  1603 	TDblQueIter<CFileShare> fileShareIter(iFileCB->FileShareList());
  1599 	while(count--)
  1604 	CFileShare* pFileShare;
  1600 		{
  1605 	while ((pFileShare = fileShareIter++) != NULL)
  1601 		CFileShare* share = (CFileShare*)(*FileShares)[count];
  1606 		{
  1602 		if (&share->File() == iFileCB)
  1607 		pFileShare->iFlushError = iFlushError;
  1603 			{
  1608 		}
  1604 			share->iFlushError = iFlushError;
       
  1605 			}
       
  1606 		}
       
  1607 	FileShares->Unlock();
       
  1608 	}
  1609 	}
  1609 
  1610 
  1610 /**
  1611 /**
  1611 CFileCache::DoFlushDirty()
  1612 CFileCache::DoFlushDirty()
  1612 
  1613