userlibandfileserver/fileserver/sfile/sf_file_cache.cpp
changeset 286 48e57fb1237e
parent 254 1560c419b176
child 297 b2826f67641f
child 300 1d28c8722707
equal deleted inserted replaced
285:ff5437e4337c 286:48e57fb1237e
  2115 	__ASSERT_ALWAYS(session, Fault(EDirtyDataOwnerNull));
  2115 	__ASSERT_ALWAYS(session, Fault(EDirtyDataOwnerNull));
  2116 
  2116 
  2117 	// Remember the last session which caused the file to become dirty
  2117 	// Remember the last session which caused the file to become dirty
  2118 	// Always record whether any session has reserved access so the CheckDiskSpace() behaves correctly
  2118 	// Always record whether any session has reserved access so the CheckDiskSpace() behaves correctly
  2119 	if (iDirtyDataOwner == NULL || session->ReservedAccess(iDriveNum))
  2119 	if (iDirtyDataOwner == NULL || session->ReservedAccess(iDriveNum))
       
  2120 		{
       
  2121 		if (iDirtyDataOwner)
       
  2122 			iDirtyDataOwner->Close();
  2120 		iDirtyDataOwner = session;
  2123 		iDirtyDataOwner = session;
       
  2124 		// open the session to prevent it from being deleted while there is dirty data
       
  2125 		iDirtyDataOwner->Open();
       
  2126 		}
  2121 
  2127 
  2122 	// start a timer after which file will be flushed
  2128 	// start a timer after which file will be flushed
  2123 	CDriveThread* driveThread=NULL;
  2129 	CDriveThread* driveThread=NULL;
  2124 	TInt r = FsThreadManager::GetDriveThread(iDriveNum, &driveThread);
  2130 	TInt r = FsThreadManager::GetDriveThread(iDriveNum, &driveThread);
  2125 	if(r == KErrNone && driveThread != NULL)
  2131 	if(r == KErrNone && driveThread != NULL)
  2130 /**
  2136 /**
  2131     Mark the file as clean and stop dirty data timer
  2137     Mark the file as clean and stop dirty data timer
  2132 */
  2138 */
  2133 void CFileCache::MarkFileClean()
  2139 void CFileCache::MarkFileClean()
  2134 	{
  2140 	{
       
  2141 	if (iDirtyDataOwner)
       
  2142 		iDirtyDataOwner->Close();
       
  2143 
  2135 	iDirtyDataOwner = NULL;
  2144 	iDirtyDataOwner = NULL;
  2136 
  2145 
  2137 	if (!iDriveThread)
  2146 	if (!iDriveThread)
  2138 		return;
  2147 		return;
  2139 
  2148