userlibandfileserver/fileserver/sfat32/sl_dir_cache.h
branchRCL_3
changeset 43 c1f20ce4abcf
parent 22 2f92ad2dc5db
child 44 3e88ff8f41d5
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Thu Aug 19 11:14:22 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Tue Aug 31 16:34:26 2010 +0300
@@ -27,6 +27,7 @@
 #include "sf_memory_client.h"
 #include "sl_cache.h"
 #include <e32hashtab.h>
+#include <f32dbg.h>
 
 //---------------------------------------------------------------------------------------------------------------------------------
 class 	CDynamicDirCache;
@@ -132,9 +133,11 @@
 	
 	TUint32 PageSizeInSegs() const;
 
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
     // Debugging functions
 	void Dump();
-	void Info() const;
+	void Info(TDirCacheInfo* aInfo) const;
+#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 
 protected:
 	CDynamicDirCache(TDriveInterface& aDrive, TUint32 aMinSizeInBytes, TUint32 aMaxSizeInBytes, TUint32 aPageSizeInBytesLog2, TUint32 aWrGranularityLog2);
@@ -145,7 +148,7 @@
 
 	TDynamicDirCachePage* FindPageByPos(TInt64 aPos);
 	TDynamicDirCachePage* UpdateActivePageL(TInt64 aPos);
-	TDynamicDirCachePage* AllocateAndLockNewPage(TInt64 aStartMedPos);
+	TDynamicDirCachePage* AllocateAndLockNewPage(/*TInt64 aStartMedPos*/);
 	TUint8* LockPage(TDynamicDirCachePage* aPage);
 	TInt 	UnlockPage(TDynamicDirCachePage* aPage);
 	TInt 	DecommitPage(TDynamicDirCachePage* aPage);
@@ -159,7 +162,6 @@
 	TInt LookupTblAdd(TDynamicDirCachePage* aPage);
 	TDynamicDirCachePage* LookupTblFind(TInt64 aPos);
 	TInt ResetPagePos(TDynamicDirCachePage* aPage);
-	void MakePageLastLocked(TDynamicDirCachePage* aPage);
 	void DoMakePageMRU(TInt64 aPos);
 	void DoInvalidateCache(void);
 	
@@ -177,6 +179,9 @@
 	TDriveInterface&    iDrive;        		///< reference to the driver for media access
 	TUint32             iCacheDisabled : 1; ///< if not 0 the cache is disabled totally and all reads and writes go via TDriveInterface directly
 
+	TDynamicDirCachePage* iLastVisitedPage; ///< a pointer to the last visited page, we always keep it locked
+                                            ///<  to avoid excessive lock/unlock activities when we are scanning
+                                            ///<  a page on the UnlockedQueue
 	
 	// data structures for LRU page list	
 	TCachePageList 	iLockedQ;				///< the locked queue that manages all locked pages, limited by minimum page number