Go to the source code of this file.
Classes | |
struct | PCache |
struct | PgFreeslot |
struct | PCacheGlobal |
Defines | |
#define | pcache_g (GLOBAL(struct PCacheGlobal, pcache)) |
#define | pcacheEnterMutex() sqlite3_mutex_enter(pcache_g.mutex) |
#define | pcacheExitMutex() sqlite3_mutex_leave(pcache_g.mutex) |
#define | pcacheMutexHeld() sqlite3_mutex_held(pcache_g.mutex) |
#define | expensive_assert(X) |
#define | N_SORT_BUCKET_ALLOC 25 |
#define | N_SORT_BUCKET 25 |
Typedefs | |
typedef struct PgFreeslot | PgFreeslot |
Functions | |
static void | pcacheRemoveFromHash (PgHdr *pPage) |
static void | pcacheAddToHash (PgHdr *pPage) |
static int | pcacheResizeHash (PCache *pCache, int nHash) |
static void | pcacheRemoveFromList (PgHdr **ppHead, PgHdr *pPage) |
static void | pcacheAddToList (PgHdr **ppHead, PgHdr *pPage) |
static void | pcacheRemoveFromLruList (PgHdr *pPage) |
static void | pcacheAddToLruList (PgHdr *pPage) |
void | sqlite3PCacheBufferSetup (void *pBuf, int sz, int n) |
static void * | pcacheMalloc (int sz, PCache *pCache) |
void * | sqlite3PageMalloc (int sz) |
static void | pcacheFree (void *p) |
void | sqlite3PageFree (void *p) |
static PgHdr * | pcachePageAlloc (PCache *pCache) |
static void | pcachePageFree (PgHdr *p) |
static PgHdr * | pcacheRecyclePage (void) |
static int | pcacheRecycleOrAlloc (PCache *pCache, PgHdr **ppPage) |
int | sqlite3PcacheInitialize (void) |
void | sqlite3PcacheShutdown (void) |
int | sqlite3PcacheSize (void) |
void | sqlite3PcacheOpen (int szPage, int szExtra, int bPurgeable, int(*xStress)(void *, PgHdr *), void *pStress, PCache *p) |
void | sqlite3PcacheSetPageSize (PCache *pCache, int szPage) |
int | sqlite3PcacheFetch (PCache *pCache, Pgno pgno, int createFlag, PgHdr **ppPage) |
void | sqlite3PcacheRelease (PgHdr *p) |
void | sqlite3PcacheRef (PgHdr *p) |
void | sqlite3PcacheDrop (PgHdr *p) |
void | sqlite3PcacheMakeDirty (PgHdr *p) |
static void | pcacheMakeClean (PgHdr *p) |
void | sqlite3PcacheMakeClean (PgHdr *p) |
void | sqlite3PcacheCleanAll (PCache *pCache) |
void | sqlite3PcacheMove (PgHdr *p, Pgno newPgno) |
static void | pcacheClear (PCache *pCache) |
void | sqlite3PcacheTruncate (PCache *pCache, Pgno pgno) |
static void | pcacheEnforceMaxPage (void) |
void | sqlite3PcacheClose (PCache *pCache) |
int | sqlite3PcacheClear (PCache *pCache) |
static PgHdr * | pcacheMergeDirtyList (PgHdr *pA, PgHdr *pB) |
static PgHdr * | pcacheSortDirtyList (PgHdr *pIn) |
PgHdr * | sqlite3PcacheDirtyList (PCache *pCache) |
int | sqlite3PcacheRefCount (PCache *pCache) |
int | sqlite3PcachePageRefcount (PgHdr *p) |
int | sqlite3PcachePagecount (PCache *pCache) |
void | sqlite3PcacheClearFlags (PCache *pCache, int mask) |
int | sqlite3PcacheGetCachesize (PCache *pCache) |
void | sqlite3PcacheSetCachesize (PCache *pCache, int mxPage) |
Variables | |
static SQLITE_WSD struct PCacheGlobal | pcache |
#define expensive_assert | ( | X | ) |
Definition at line 121 of file pcache.c.
Referenced by pcacheAddToHash(), pcacheMakeClean(), pcacheRecycleOrAlloc(), pcacheRemoveFromHash(), sqlite3PcacheCleanAll(), and sqlite3PcacheFetch().
#define N_SORT_BUCKET 25 |
Definition at line 1027 of file pcache.c.
Referenced by pcacheSortDirtyList().
#define N_SORT_BUCKET_ALLOC 25 |
Definition at line 1026 of file pcache.c.
Referenced by pcacheSortDirtyList().
#define pcache_g (GLOBAL(struct PCacheGlobal, pcache)) |
Definition at line 90 of file pcache.c.
Referenced by pcacheAddToLruList(), pcacheClear(), pcacheEnforceMaxPage(), pcacheFree(), pcacheMalloc(), pcachePageAlloc(), pcachePageFree(), pcacheRecycleOrAlloc(), pcacheRecyclePage(), pcacheRemoveFromLruList(), sqlite3PCacheBufferSetup(), sqlite3PcacheClose(), sqlite3PcacheFetch(), sqlite3PcacheInitialize(), sqlite3PcacheOpen(), sqlite3PcacheRelease(), sqlite3PcacheSetCachesize(), and sqlite3PcacheShutdown().
#define pcacheEnterMutex | ( | ) | sqlite3_mutex_enter(pcache_g.mutex) |
Definition at line 108 of file pcache.c.
Referenced by pcacheMalloc(), pcacheRecycleOrAlloc(), pcacheResizeHash(), sqlite3PageFree(), sqlite3PageMalloc(), sqlite3PcacheCleanAll(), sqlite3PcacheClear(), sqlite3PcacheClearFlags(), sqlite3PcacheClose(), sqlite3PcacheDrop(), sqlite3PcacheFetch(), sqlite3PcacheMakeClean(), sqlite3PcacheMakeDirty(), sqlite3PcacheMove(), sqlite3PcacheOpen(), sqlite3PcacheRelease(), sqlite3PcacheSetCachesize(), and sqlite3PcacheTruncate().
#define pcacheExitMutex | ( | ) | sqlite3_mutex_leave(pcache_g.mutex) |
Definition at line 109 of file pcache.c.
Referenced by pcacheMalloc(), pcacheRecycleOrAlloc(), pcacheResizeHash(), sqlite3PageFree(), sqlite3PageMalloc(), sqlite3PcacheCleanAll(), sqlite3PcacheClear(), sqlite3PcacheClearFlags(), sqlite3PcacheClose(), sqlite3PcacheDrop(), sqlite3PcacheFetch(), sqlite3PcacheMakeClean(), sqlite3PcacheMakeDirty(), sqlite3PcacheMove(), sqlite3PcacheOpen(), sqlite3PcacheRelease(), sqlite3PcacheSetCachesize(), and sqlite3PcacheTruncate().
#define pcacheMutexHeld | ( | ) | sqlite3_mutex_held(pcache_g.mutex) |
Definition at line 110 of file pcache.c.
Referenced by pcacheAddToHash(), pcacheRemoveFromHash(), pcacheRemoveFromList(), and pcacheResizeHash().
typedef struct PgFreeslot PgFreeslot |
static void pcacheAddToHash | ( | PgHdr * | pPage | ) | [static] |
Definition at line 212 of file pcache.c.
References PCache::apHash, expensive_assert, PCache::nHash, PCache::nPage, PgHdr::pCache, pcacheMutexHeld, PgHdr::pgno, PgHdr::pNextHash, and PgHdr::pPrevHash.
Referenced by pcacheResizeHash(), sqlite3PcacheFetch(), and sqlite3PcacheMove().
Definition at line 299 of file pcache.c.
References PgHdr::flags, PgHdr::pCache, PCache::pClean, PCache::pDirty, PCache::pDirtyTail, PGHDR_NEED_SYNC, PgHdr::pNext, PgHdr::pPrev, and PCache::pSynced.
Referenced by pcacheMakeClean(), sqlite3PcacheCleanAll(), sqlite3PcacheFetch(), sqlite3PcacheMakeDirty(), and sqlite3PcacheRelease().
static void pcacheAddToLruList | ( | PgHdr * | pPage | ) | [static] |
Definition at line 351 of file pcache.c.
References PCache::bPurgeable, PgHdr::flags, PgHdr::pCache, pcache_g, PGHDR_DIRTY, PGHDR_REUSE_UNLIKELY, PgHdr::pNextLru, PgHdr::pPrevLru, and sqlite3_mutex_held.
Referenced by pcacheMakeClean(), sqlite3PcacheCleanAll(), and sqlite3PcacheRelease().
static void pcacheClear | ( | PCache * | pCache | ) | [static] |
Definition at line 878 of file pcache.c.
References PCache::apHash, PCache::nHash, PCache::nPage, PCache::nPinned, pcache_g, pcachePageFree(), pcacheRemoveFromLruList(), PCache::pClean, PCache::pDirty, PCache::pDirtyTail, PgHdr::pNext, and sqlite3_mutex_held.
Referenced by sqlite3PcacheClear(), and sqlite3PcacheClose().
static void pcacheEnforceMaxPage | ( | void | ) | [static] |
Definition at line 938 of file pcache.c.
References pcache_g, pcachePageFree(), pcacheRecyclePage(), and sqlite3_mutex_held.
Referenced by sqlite3PcacheClose(), and sqlite3PcacheSetCachesize().
static void pcacheFree | ( | void * | p | ) | [static] |
Definition at line 447 of file pcache.c.
References pcache_g, PgFreeslot::pNext, sqlite3_free(), sqlite3_mutex_held, sqlite3MallocSize(), sqlite3StatusAdd(), SQLITE_STATUS_PAGECACHE_OVERFLOW, and SQLITE_STATUS_PAGECACHE_USED.
Referenced by pcachePageFree(), and sqlite3PageFree().
static void pcacheMakeClean | ( | PgHdr * | p | ) | [static] |
Definition at line 810 of file pcache.c.
References expensive_assert, PgHdr::flags, PCache::nPinned, PgHdr::nRef, PgHdr::pCache, pcacheAddToList(), pcacheAddToLruList(), pcacheRemoveFromList(), PCache::pClean, PCache::pDirty, and PGHDR_DIRTY.
Referenced by sqlite3PcacheMakeClean(), and sqlite3PcacheMove().
static void* pcacheMalloc | ( | int | sz, | |
PCache * | pCache | |||
) | [static] |
Definition at line 408 of file pcache.c.
References pcache_g, pcacheEnterMutex, pcacheExitMutex, PgFreeslot::pNext, sqlite3_mutex_held, sqlite3Malloc(), sqlite3MallocSize(), sqlite3StatusAdd(), sqlite3StatusSet(), SQLITE_STATUS_PAGECACHE_OVERFLOW, SQLITE_STATUS_PAGECACHE_SIZE, and SQLITE_STATUS_PAGECACHE_USED.
Referenced by pcachePageAlloc(), and sqlite3PageMalloc().
Definition at line 997 of file pcache.c.
References PgHdr::pDirty, and PgHdr::pgno.
Referenced by pcacheSortDirtyList().
Definition at line 471 of file pcache.c.
References PCache::bPurgeable, pcache_g, pcacheMalloc(), PgHdr::pData, PgHdr::pExtra, sqlite3_mutex_held, PCache::szExtra, and PCache::szPage.
Referenced by pcacheRecycleOrAlloc().
static void pcachePageFree | ( | PgHdr * | p | ) | [static] |
Definition at line 489 of file pcache.c.
References PCache::bPurgeable, PgHdr::pCache, pcache_g, pcacheFree(), and sqlite3_mutex_held.
Referenced by pcacheClear(), pcacheEnforceMaxPage(), pcacheRecycleOrAlloc(), sqlite3PcacheDrop(), sqlite3PcacheRelease(), and sqlite3PcacheTruncate().
Definition at line 542 of file pcache.c.
References PCache::bPurgeable, expensive_assert, PgHdr::flags, PCache::nMax, PCache::nMin, PCache::nPage, PCache::nPinned, PgHdr::nRef, PgHdr::pCache, pcache_g, pcacheEnterMutex, pcacheExitMutex, pcachePageAlloc(), pcachePageFree(), pcacheRecyclePage(), PCache::pDirty, PCache::pDirtyTail, PGHDR_NEED_SYNC, PgHdr::pPrev, PCache::pStress, PCache::pSynced, sqlite3_mutex_held, SQLITE_BUSY, SQLITE_NOMEM, SQLITE_OK, PCache::szExtra, PCache::szPage, and PCache::xStress.
Referenced by sqlite3PcacheFetch().
static PgHdr* pcacheRecyclePage | ( | void | ) | [static] |
Definition at line 521 of file pcache.c.
References PgHdr::flags, PgHdr::pCache, pcache_g, pcacheRemoveFromHash(), pcacheRemoveFromList(), pcacheRemoveFromLruList(), PCache::pClean, PGHDR_DIRTY, and sqlite3_mutex_held.
Referenced by pcacheEnforceMaxPage(), and pcacheRecycleOrAlloc().
static void pcacheRemoveFromHash | ( | PgHdr * | pPage | ) | [static] |
Definition at line 190 of file pcache.c.
References PCache::apHash, expensive_assert, PCache::nHash, PCache::nPage, PgHdr::pCache, pcacheMutexHeld, PgHdr::pgno, PgHdr::pNextHash, and PgHdr::pPrevHash.
Referenced by pcacheRecyclePage(), sqlite3PcacheDrop(), sqlite3PcacheMove(), sqlite3PcacheRelease(), and sqlite3PcacheTruncate().
Definition at line 264 of file pcache.c.
References PgHdr::flags, PgHdr::pCache, pcacheMutexHeld, PCache::pClean, PCache::pDirty, PCache::pDirtyTail, PGHDR_NEED_SYNC, PgHdr::pNext, PgHdr::pPrev, and PCache::pSynced.
Referenced by pcacheMakeClean(), pcacheRecyclePage(), sqlite3PcacheCleanAll(), sqlite3PcacheDrop(), sqlite3PcacheMakeDirty(), sqlite3PcacheRelease(), and sqlite3PcacheTruncate().
static void pcacheRemoveFromLruList | ( | PgHdr * | pPage | ) | [static] |
Definition at line 325 of file pcache.c.
References PCache::bPurgeable, PgHdr::flags, PgHdr::pCache, pcache_g, PGHDR_DIRTY, PgHdr::pNextLru, PgHdr::pPrevLru, and sqlite3_mutex_held.
Referenced by pcacheClear(), pcacheRecyclePage(), sqlite3PcacheFetch(), and sqlite3PcacheTruncate().
static int pcacheResizeHash | ( | PCache * | pCache, | |
int | nHash | |||
) | [static] |
Definition at line 230 of file pcache.c.
References PCache::apHash, PCache::nHash, PCache::nPage, pcacheAddToHash(), pcacheEnterMutex, pcacheExitMutex, pcacheMutexHeld, PCache::pClean, PCache::pDirty, PgHdr::pNext, sqlite3_free(), sqlite3Malloc(), SQLITE_NOMEM, and SQLITE_OK.
Referenced by sqlite3PcacheFetch().
Definition at line 1034 of file pcache.c.
References N_SORT_BUCKET, N_SORT_BUCKET_ALLOC, pcacheMergeDirtyList(), and PgHdr::pDirty.
Referenced by sqlite3PcacheDirtyList().
void sqlite3PageFree | ( | void * | p | ) |
Definition at line 462 of file pcache.c.
References pcacheEnterMutex, pcacheExitMutex, and pcacheFree().
Referenced by balance_nonroot(), checkTreePage(), freeTempSpace(), sqlite3PagerClose(), and sqlite3PagerSetPagesize().
void* sqlite3PageMalloc | ( | int | sz | ) |
Definition at line 436 of file pcache.c.
References pcacheEnterMutex, pcacheExitMutex, and pcacheMalloc().
Referenced by allocateTempSpace(), balance_nonroot(), checkTreePage(), sqlite3PagerOpen(), and sqlite3PagerSetPagesize().
void sqlite3PCacheBufferSetup | ( | void * | pBuf, | |
int | sz, | |||
int | n | |||
) |
Definition at line 388 of file pcache.c.
References pcache_g, and PgFreeslot::pNext.
Referenced by sqlite3_initialize().
void sqlite3PcacheCleanAll | ( | PCache * | pCache | ) |
Definition at line 838 of file pcache.c.
References expensive_assert, PgHdr::flags, PCache::nPinned, PgHdr::nRef, pcacheAddToList(), pcacheAddToLruList(), pcacheEnterMutex, pcacheExitMutex, pcacheRemoveFromList(), PCache::pClean, PCache::pDirty, PGHDR_DIRTY, and sqlite3PcacheAssertFlags.
Referenced by pager_end_transaction(), and sqlite3PagerCommitPhaseOne().
int sqlite3PcacheClear | ( | PCache * | pCache | ) |
Definition at line 985 of file pcache.c.
References PCache::nRef, pcacheClear(), pcacheEnterMutex, pcacheExitMutex, and SQLITE_OK.
Referenced by pager_reset().
void sqlite3PcacheClearFlags | ( | PCache * | pCache, | |
int | mask | |||
) |
Definition at line 1117 of file pcache.c.
References PgHdr::flags, pcacheEnterMutex, pcacheExitMutex, PCache::pClean, PCache::pDirty, PCache::pDirtyTail, PGHDR_NEED_SYNC, PgHdr::pNext, and PCache::pSynced.
Referenced by pager_end_transaction(), and syncJournal().
void sqlite3PcacheClose | ( | PCache * | pCache | ) |
Definition at line 950 of file pcache.c.
References PCache::apHash, PCache::bPurgeable, PCache::nMax, PCache::nMin, pcache_g, pcacheClear(), pcacheEnforceMaxPage(), pcacheEnterMutex, pcacheExitMutex, and sqlite3_free().
Referenced by sqlite3PagerClose().
Definition at line 1070 of file pcache.c.
References pcacheSortDirtyList(), PgHdr::pDirty, PCache::pDirty, and PgHdr::pNext.
Referenced by sqlite3PagerCommitPhaseOne().
void sqlite3PcacheDrop | ( | PgHdr * | p | ) |
Definition at line 778 of file pcache.c.
References PgHdr::flags, PCache::nPinned, PCache::nRef, PgHdr::nRef, PgHdr::pCache, pcacheEnterMutex, pcacheExitMutex, pcachePageFree(), pcacheRemoveFromHash(), pcacheRemoveFromList(), PCache::pClean, and PGHDR_DIRTY.
Referenced by pagerDropPage().
Definition at line 676 of file pcache.c.
References PCache::apHash, expensive_assert, PgHdr::flags, PCache::nHash, PCache::nPage, PCache::nPinned, PCache::nRef, PgHdr::nRef, PgHdr::pCache, pcache_g, pcacheAddToHash(), pcacheAddToList(), pcacheEnterMutex, pcacheExitMutex, pcacheRecycleOrAlloc(), pcacheRemoveFromLruList(), pcacheResizeHash(), PCache::pClean, PgHdr::pDirty, PGHDR_DIRTY, PgHdr::pgno, PgHdr::pNextHash, PgHdr::pPager, and SQLITE_OK.
Referenced by pager_lookup(), sqlite3PagerAcquire(), and sqlite3PagerLookup().
int sqlite3PcacheGetCachesize | ( | PCache * | pCache | ) |
Definition at line 1144 of file pcache.c.
References PCache::nMax.
int sqlite3PcacheInitialize | ( | void | ) |
Definition at line 612 of file pcache.c.
References pcache, pcache_g, sqlite3_mutex_alloc, sqlite3GlobalConfig, SQLITE_MUTEX_STATIC_LRU, and SQLITE_OK.
Referenced by sqlite3_initialize().
void sqlite3PcacheMakeClean | ( | PgHdr * | p | ) |
Definition at line 827 of file pcache.c.
References PgHdr::flags, pcacheEnterMutex, pcacheExitMutex, pcacheMakeClean(), and PGHDR_DIRTY.
Referenced by makeClean(), and pagerStress().
void sqlite3PcacheMakeDirty | ( | PgHdr * | p | ) |
Definition at line 796 of file pcache.c.
References PgHdr::flags, PgHdr::nRef, PgHdr::pCache, pcacheAddToList(), pcacheEnterMutex, pcacheExitMutex, pcacheRemoveFromList(), PCache::pClean, PCache::pDirty, PGHDR_DIRTY, and PGHDR_DONT_WRITE.
Referenced by makeDirty().
Definition at line 860 of file pcache.c.
References PgHdr::flags, PgHdr::nRef, pcacheAddToHash(), pcacheEnterMutex, pcacheExitMutex, pcacheMakeClean(), pcacheRemoveFromHash(), PGHDR_DIRTY, PGHDR_REUSE_UNLIKELY, and PgHdr::pgno.
Referenced by sqlite3PagerMovepage().
void sqlite3PcacheOpen | ( | int | szPage, | |
int | szExtra, | |||
int | bPurgeable, | |||
int(*)(void *, PgHdr *) | xStress, | |||
void * | pStress, | |||
PCache * | p | |||
) |
Definition at line 637 of file pcache.c.
References PCache::bPurgeable, PCache::nMax, PCache::nMin, pcache_g, pcacheEnterMutex, pcacheExitMutex, PCache::pStress, PCache::szExtra, PCache::szPage, and PCache::xStress.
Referenced by sqlite3PagerOpen().
int sqlite3PcachePagecount | ( | PCache * | pCache | ) |
Definition at line 1092 of file pcache.c.
References PCache::nPage.
Referenced by pagerSharedLock().
int sqlite3PcachePageRefcount | ( | PgHdr * | p | ) |
Definition at line 1085 of file pcache.c.
References PgHdr::nRef.
Referenced by sqlite3PagerPageRefcount().
void sqlite3PcacheRef | ( | PgHdr * | p | ) |
int sqlite3PcacheRefCount | ( | PCache * | pCache | ) |
Definition at line 1081 of file pcache.c.
References PCache::nRef.
Referenced by pager_error(), pagerSharedLock(), pagerUnlockIfUnused(), sqlite3PagerAcquire(), sqlite3PagerRefcount(), and sqlite3PagerSetPagesize().
void sqlite3PcacheRelease | ( | PgHdr * | p | ) |
Definition at line 743 of file pcache.c.
References PgHdr::flags, PCache::nPinned, PCache::nRef, PgHdr::nRef, PgHdr::pCache, pcache_g, pcacheAddToList(), pcacheAddToLruList(), pcacheEnterMutex, pcacheExitMutex, pcachePageFree(), pcacheRemoveFromHash(), pcacheRemoveFromList(), PCache::pClean, PCache::pDirty, and PGHDR_DIRTY.
Referenced by pager_playback_one_page(), sqlite3PagerMovepage(), and sqlite3PagerUnref().
void sqlite3PcacheSetCachesize | ( | PCache * | pCache, | |
int | mxPage | |||
) |
Definition at line 1151 of file pcache.c.
References PCache::bPurgeable, PCache::nMax, pcache_g, pcacheEnforceMaxPage(), pcacheEnterMutex, and pcacheExitMutex.
Referenced by sqlite3PagerSetCachesize().
void sqlite3PcacheSetPageSize | ( | PCache * | pCache, | |
int | szPage | |||
) |
Definition at line 668 of file pcache.c.
References PCache::nPage, and PCache::szPage.
Referenced by sqlite3PagerSetPagesize().
void sqlite3PcacheShutdown | ( | void | ) |
Definition at line 624 of file pcache.c.
References pcache, and pcache_g.
Referenced by sqlite3_shutdown().
int sqlite3PcacheSize | ( | void | ) |
Definition at line 631 of file pcache.c.
Referenced by sqlite3PagerOpen().
Definition at line 902 of file pcache.c.
References PgHdr::flags, PCache::nPinned, PgHdr::nRef, pcacheEnterMutex, pcacheExitMutex, pcachePageFree(), pcacheRemoveFromHash(), pcacheRemoveFromList(), pcacheRemoveFromLruList(), PCache::pClean, PgHdr::pData, PCache::pDirty, PGHDR_DIRTY, PgHdr::pgno, PgHdr::pNext, and PCache::szPage.
Referenced by pager_truncate_cache().
SQLITE_WSD struct PCacheGlobal pcache [static] |
Referenced by sqlite3PcacheInitialize(), and sqlite3PcacheShutdown().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:01 2011 by Doxygen 1.6.1