userlibandfileserver/fileserver/sfat32/sl_dir_cache.h
changeset 176 af6ec97d9189
parent 90 947f0dc9f7a8
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Wed Jun 23 11:59:44 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Wed Jun 23 12:52:28 2010 +0100
@@ -27,6 +27,7 @@
 #include "sf_memory_client.h"
 #include "sl_cache.h"
 #include <e32hashtab.h>
+#include <f32dbg.h>
 
 //---------------------------------------------------------------------------------------------------------------------------------
 class 	CDynamicDirCache;
@@ -47,7 +48,7 @@
 
 public:
 	~TDynamicDirCachePage();
-	static TDynamicDirCachePage* NewL(CDynamicDirCache* aOwnerCache, TInt64 aStartMedPos, TUint8* aStartRamAddr);
+	static TDynamicDirCachePage* CreateCachePage(CDynamicDirCache* aOwnerCache, TInt64 aStartMedPos, TUint8* aStartRamAddr);
 	
 	inline void	SetLocked(TBool);
 	inline TBool	IsLocked() const;
@@ -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* AllocateAndLockNewPageL(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