persistentstorage/store/USTOR/UT_COLL.CPP
branchRCL_3
changeset 23 26645d81f48d
parent 16 b6ab70c1385f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
   901 		if (ext>=0)
   901 		if (ext>=0)
   902 			return ext;
   902 			return ext;
   903 		}
   903 		}
   904 	return ::ExtentL(Host(),iMark,Coord().Base(),aStream);
   904 	return ::ExtentL(Host(),iMark,Coord().Base(),aStream);
   905 	}
   905 	}
   906 	
   906 
   907 /* relocate a stream into [iFree, aExtent)
   907 /* relocate a stream into [iFree, aExtent)
   908 
   908 
   909 During compaction, for each string which is to be moved from position A1 to B1, the sequence of operations is:
   909 During compaction, for each string which is to be moved from position A1 to B1, the sequence of operations is:
   910 
   910 
   911 1.  Copy stream S1 content from position A1 to position B1 . The copy never overlaps so the old stream content is still good at this point.
   911 1.  Copy stream S1 content from position A1 to position B1 . The copy never overlaps so the old stream content is still good at this point.
   940 
   940 
   941 Based on the knowledge above, it is strongly recommended to set EFileWriteDirectIO bit when opening the file so that the order is maintained
   941 Based on the knowledge above, it is strongly recommended to set EFileWriteDirectIO bit when opening the file so that the order is maintained
   942 when writing to the file.
   942 when writing to the file.
   943 */
   943 */
   944 void CPermanentStoreCollector::RelocateStreamL(const CPermanentStoreCollector::TEntry& aReloc, TInt aExtent)
   944 void CPermanentStoreCollector::RelocateStreamL(const CPermanentStoreCollector::TEntry& aReloc, TInt aExtent)
   945 
       
   946 	{
   945 	{
   947 	if (Coord().Accessed())	// must have exclusive access to relocate the stream
   946 	if (Coord().Accessed())	// must have exclusive access to relocate the stream
   948 		__LEAVE(KErrInUse);
   947 		__LEAVE(KErrInUse);
   949 //
   948 //
   950 	TInt end=RelocateL(aReloc.entry.ref,aReloc.len,aReloc.entry.handle == KHandleTocBase ? EFrameDescriptive16 : EFrameData16, aExtent);
   949 	TInt end=RelocateL(aReloc.entry.ref,aReloc.len,aReloc.entry.handle == KHandleTocBase ? EFrameDescriptive16 : EFrameData16, aExtent);
   951 	//Step 1
   950 	//Step 1, 4,....
   952 	Coord().RelocateL(aReloc.entry.handle, iFree);
   951 	Coord().RelocateL(aReloc.entry.handle, iFree);
   953 	// Step 2 & 3
   952 	// Step 2 & 3, 5 & 6,...
   954 	iCoordGen=Coord().Generation();	// changed by relocation
   953 	iCoordGen=Coord().Generation();	// changed by relocation
   955 	iFree = end;
   954 	iFree = end;
   956 	}
   955 	}
   957 
   956 
   958 TInt CPermanentStoreCollector::RelocateL(TInt aStream, TInt aLength, TFrameType16 aType, TInt aExtent)
   957 TInt CPermanentStoreCollector::RelocateL(TInt aStream, TInt aLength, TFrameType16 aType, TInt aExtent)