Lines Matching refs:pcache1
32902 /* Update the PCache1.pSynced variable if necessary. */
32930 ** Add page pPage to the head of the dirty list (PCache1.pDirty is set to
33419 /************** Begin file pcache1.c *****************************************/
33440 typedef struct PCache1 PCache1;
33452 struct PCache1 {
33484 PCache1 *pCache; /* Cache that currently owns this page */
33520 ** alias "pcache1". This ensures that the WSD emulation is used when
33523 #define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g))
33526 ** When a PgHdr1 structure is allocated, the associated PCache1.szPage
33528 ** size of the allocation is sizeof(PgHdr1)+PCache1.szPage byte). The
33543 #define pcache1EnterMutex() sqlite3_mutex_enter(pcache1.mutex)
33544 #define pcache1LeaveMutex() sqlite3_mutex_leave(pcache1.mutex)
33556 if( pcache1.isInit ){
33559 pcache1.szSlot = sz;
33560 pcache1.nSlot = pcache1.nFreeSlot = n;
33561 pcache1.nReserve = n>90 ? 10 : (n/10 + 1);
33562 pcache1.pStart = pBuf;
33563 pcache1.pFree = 0;
33566 p->pNext = pcache1.pFree;
33567 pcache1.pFree = p;
33570 pcache1.pEnd = pBuf;
33582 assert( sqlite3_mutex_held(pcache1.mutex) );
33584 if( nByte<=pcache1.szSlot && pcache1.pFree ){
33585 assert( pcache1.isInit );
33586 p = (PgHdr1 *)pcache1.pFree;
33587 pcache1.pFree = pcache1.pFree->pNext;
33588 pcache1.nFreeSlot--;
33589 assert( pcache1.nFreeSlot>=0 );
33615 assert( sqlite3_mutex_held(pcache1.mutex) );
33617 if( p>=pcache1.pStart && p<pcache1.pEnd ){
33621 pSlot->pNext = pcache1.pFree;
33622 pcache1.pFree = pSlot;
33623 pcache1.nFreeSlot++;
33624 assert( pcache1.nFreeSlot<=pcache1.nSlot );
33640 assert( sqlite3_mutex_held(pcache1.mutex) );
33641 if( p>=pcache1.pStart && p<pcache1.pEnd ){
33642 return pcache1.szSlot;
33657 static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
33664 pcache1.nCurrentPage++;
33682 pcache1.nCurrentPage--;
33727 static int pcache1UnderMemoryPressure(PCache1 *pCache){
33728 assert( sqlite3_mutex_held(pcache1.mutex) );
33729 if( pcache1.nSlot && pCache->szPage<=pcache1.szSlot ){
33730 return pcache1.nFreeSlot<pcache1.nReserve;
33745 static int pcache1ResizeHash(PCache1 *p){
33750 assert( sqlite3_mutex_held(pcache1.mutex) );
33790 assert( sqlite3_mutex_held(pcache1.mutex) );
33791 if( pPage && (pPage->pLruNext || pPage==pcache1.pLruTail) ){
33798 if( pcache1.pLruHead==pPage ){
33799 pcache1.pLruHead = pPage->pLruNext;
33801 if( pcache1.pLruTail==pPage ){
33802 pcache1.pLruTail = pPage->pLruPrev;
33813 ** (PCache1.apHash structure) that it is currently stored in.
33819 PCache1 *pCache = pPage->pCache;
33834 assert( sqlite3_mutex_held(pcache1.mutex) );
33835 while( pcache1.nCurrentPage>pcache1.nMaxPage && pcache1.pLruTail ){
33836 PgHdr1 *p = pcache1.pLruTail;
33851 PCache1 *pCache,
33856 assert( sqlite3_mutex_held(pcache1.mutex) );
33883 assert( pcache1.isInit==0 );
33884 memset(&pcache1, 0, sizeof(pcache1));
33886 pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU);
33888 pcache1.isInit = 1;
33899 assert( pcache1.isInit!=0 );
33900 memset(&pcache1, 0, sizeof(pcache1));
33909 PCache1 *pCache;
33911 pCache = (PCache1 *)sqlite3_malloc(sizeof(PCache1));
33913 memset(pCache, 0, sizeof(PCache1));
33919 pcache1.nMinPage += pCache->nMin;
33932 PCache1 *pCache = (PCache1 *)p;
33935 pcache1.nMaxPage += (nMax - pCache->nMax);
33948 n = ((PCache1 *)p)->nPage;
33982 ** PCache1.nMax, or
33992 ** PCache1.nMax, or
34009 PCache1 *pCache = (PCache1 *)p;
34030 nPinned>=(pcache1.nMaxPage+pCache->nMin-pcache1.nMinPage)
34042 if( pCache->bPurgeable && pcache1.pLruTail && (
34044 || pcache1.nCurrentPage>=pcache1.nMaxPage
34047 pPage = pcache1.pLruTail;
34054 pcache1.nCurrentPage -= (pPage->pCache->bPurgeable - pCache->bPurgeable);
34093 PCache1 *pCache = (PCache1 *)p;
34103 assert( pcache1.pLruHead!=pPage && pcache1.pLruTail!=pPage );
34105 if( reuseUnlikely || pcache1.nCurrentPage>pcache1.nMaxPage ){
34114 if( pcache1.pLruHead ){
34115 pcache1.pLruHead->pLruPrev = pPage;
34116 pPage->pLruNext = pcache1.pLruHead;
34117 pcache1.pLruHead = pPage;
34119 pcache1.pLruTail = pPage;
34120 pcache1.pLruHead = pPage;
34137 PCache1 *pCache = (PCache1 *)p;
34172 PCache1 *pCache = (PCache1 *)p;
34187 PCache1 *pCache = (PCache1 *)p;
34191 pcache1.nMaxPage -= pCache->nMax;
34192 pcache1.nMinPage -= pCache->nMin;
34233 if( pcache1.pStart==0 ){
34236 while( (nReq<0 || nFree<nReq) && ((p=pcache1.pLruTail)!=0) ){
34256 int *pnMin, /* OUT: Sum of PCache1.nMin for purgeable caches */
34261 for(p=pcache1.pLruHead; p; p=p->pLruNext){
34264 *pnCurrent = pcache1.nCurrentPage;
34265 *pnMax = pcache1.nMaxPage;
34266 *pnMin = pcache1.nMinPage;
34271 /************** End of pcache1.c *********************************************/