Lines Matching refs:pPg
34921 PgHdr *pPg;
34929 for(pPg=pCache->pSynced;
34930 pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC));
34931 pPg=pPg->pDirtyPrev
34933 pCache->pSynced = pPg;
34934 if( !pPg ){
34935 for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);
34937 if( pPg ){
34942 pPg->pgno, pgno,
34946 rc = pCache->xStress(pCache->pStress, pPg);
35570 void *pPg = pcache1Alloc(nByte);
35572 if( pPg ){
35573 p = PAGE_TO_PGHDR1(pCache, pPg);
36066 static void pcache1Unpin(sqlite3_pcache *p, void *pPg, int reuseUnlikely){
36068 PgHdr1 *pPage = PAGE_TO_PGHDR1(pCache, pPg);
36104 void *pPg,
36109 PgHdr1 *pPage = PAGE_TO_PGHDR1(pCache, pPg);
37787 static int subjRequiresPage(PgHdr *pPg){
37788 Pgno pgno = pPg->pgno;
37789 Pager *pPager = pPg->pPager;
37803 static int pageInJournal(PgHdr *pPg){
37804 return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno);
37960 static void checkPage(PgHdr *pPg){
37961 Pager *pPager = pPg->pPager;
37963 assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) );
38899 PgHdr *pPg; /* An existing page in the cache */
39006 pPg = 0;
39008 pPg = pager_lookup(pPager, pgno);
39010 assert( pPg || !MEMDB );
39011 assert( pPager->eState!=PAGER_OPEN || pPg==0 );
39019 isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));
39026 testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );
39037 }else if( !isMainJrnl && pPg==0 ){
39057 rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1);
39061 pPg->flags &= ~PGHDR_NEED_READ;
39062 sqlite3PcacheMakeDirty(pPg);
39064 if( pPg ){
39072 pData = pPg->pData;
39074 pPager->xReiniter(pPg);
39096 sqlite3PcacheMakeClean(pPg);
39098 pager_set_pagehash(pPg);
39107 CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM);
39108 sqlite3PcacheRelease(pPg);
39590 static int readDbPage(PgHdr *pPg){
39591 Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
39592 Pgno pgno = pPg->pgno; /* Page number to read */
39602 memset(pPg->pData, 0, pPager->pageSize);
39608 rc = sqlite3WalRead(pPager->pWal, pgno, &isInWal, pgsz, pPg->pData);
39612 rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset);
39634 u8 *dbFileVers = &((u8*)pPg->pData)[24];
39638 CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
39644 PAGERID(pPager), pgno, pager_pagehash(pPg)));
39657 static void pager_write_changecounter(PgHdr *pPg){
39661 change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1;
39662 put32bits(((char*)pPg->pData)+24, change_counter);
39667 put32bits(((char*)pPg->pData)+92, change_counter);
39668 put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER);
39687 PgHdr *pPg;
39689 pPg = sqlite3PagerLookup(pPager, iPg);
39690 if( pPg ){
39691 if( sqlite3PcachePageRefcount(pPg)==1 ){
39692 sqlite3PcacheDrop(pPg);
39694 rc = readDbPage(pPg);
39696 pPager->xReiniter(pPg);
39698 sqlite3PagerUnref(pPg);
40470 static void assertTruncateConstraintCb(PgHdr *pPg){
40471 assert( pPg->flags&PGHDR_DIRTY );
40472 assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
40589 SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){
40590 return pPg->pgno;
40597 SQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){
40598 sqlite3PcacheRef(pPg);
40892 static int subjournalPage(PgHdr *pPg){
40894 Pager *pPager = pPg->pPager;
40902 || pageInJournal(pPg)
40903 || pPg->pgno>pPager->dbOrigSize
40910 void *pData = pPg->pData;
40914 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
40915 PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
40916 rc = write32bits(pPager->sjfd, offset, pPg->pgno);
40925 rc = addToSavepointBitvecs(pPager, pPg->pgno);
40949 static int pagerStress(void *p, PgHdr *pPg){
40953 assert( pPg->pPager==pPager );
40954 assert( pPg->flags&PGHDR_DIRTY );
40973 if( pPager->doNotSyncSpill && (pPg->flags & PGHDR_NEED_SYNC)!=0 ){
40977 pPg->pDirty = 0;
40980 if( subjRequiresPage(pPg) ){
40981 rc = subjournalPage(pPg);
40984 rc = pagerWalFrames(pPager, pPg, 0, 0, 0);
40989 if( pPg->flags&PGHDR_NEED_SYNC
41023 rc==SQLITE_OK && pPg->pgno>pPager->dbSize && subjRequiresPage(pPg)
41025 rc = subjournalPage(pPg);
41030 assert( (pPg->flags&PGHDR_NEED_SYNC)==0 );
41031 rc = pager_write_pagelist(pPager, pPg);
41037 PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno));
41038 sqlite3PcacheMakeClean(pPg);
41771 PgHdr *pPg;
41792 pPg = 0;
41810 pPg = *ppPage;
41811 pPg->pPager = pPager;
41841 memset(pPg->pData, 0, pPager->pageSize);
41844 assert( pPg->pPager==pPager );
41845 rc = readDbPage(pPg);
41850 pager_set_pagehash(pPg);
41857 if( pPg ){
41858 sqlite3PcacheDrop(pPg);
41878 PgHdr *pPg = 0;
41883 sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
41884 return pPg;
41895 SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){
41896 if( pPg ){
41897 Pager *pPager = pPg->pPager;
41898 sqlite3PcacheRelease(pPg);
42081 static int pager_write(PgHdr *pPg){
42082 void *pData = pPg->pData;
42083 Pager *pPager = pPg->pPager;
42104 CHECK_PAGE(pPg);
42125 sqlite3PcacheMakeDirty(pPg);
42126 if( pageInJournal(pPg) && !subjRequiresPage(pPg) ){
42134 if( !pageInJournal(pPg) && !pagerUseWal(pPager) ){
42136 if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){
42144 assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
42147 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
42157 pPg->flags |= PGHDR_NEED_SYNC;
42159 rc = write32bits(pPager->jfd, iOff, pPg->pgno);
42166 IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno,
42170 PAGERID(pPager), pPg->pgno,
42171 ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg)));
42176 rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
42179 rc |= addToSavepointBitvecs(pPager, pPg->pgno);
42186 pPg->flags |= PGHDR_NEED_SYNC;
42189 PAGERID(pPager), pPg->pgno,
42190 ((pPg->flags&PGHDR_NEED_SYNC)?1:0)));
42199 if( subjRequiresPage(pPg) ){
42200 rc = subjournalPage(pPg);
42206 if( pPager->dbSize<pPg->pgno ){
42207 pPager->dbSize = pPg->pgno;
42229 PgHdr *pPg = pDbPage;
42230 Pager *pPager = pPg->pPager;
42256 pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;
42259 if( pPg->pgno>nPageCount ){
42260 nPage = (pPg->pgno - pg1)+1;
42267 assert(pg1<=pPg->pgno);
42268 assert((pg1+nPage)>pPg->pgno);
42273 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
42323 SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){
42324 return pPg->flags&PGHDR_DIRTY;
42342 SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
42343 Pager *pPager = pPg->pPager;
42344 if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
42345 PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
42346 IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
42347 pPg->flags |= PGHDR_DONT_WRITE;
42348 pager_set_pagehash(pPg);
42588 PgHdr *pPg;
42596 && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)
43109 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
43115 assert( pPg->nRef>0 );
43125 rc = sqlite3PagerWrite(pPg);
43147 if( pPg->flags&PGHDR_DIRTY
43148 && subjRequiresPage(pPg)
43149 && SQLITE_OK!=(rc = subjournalPage(pPg))
43155 PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));
43156 IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno))
43165 if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){
43166 needSyncPgno = pPg->pgno;
43167 assert( pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize );
43168 assert( pPg->flags&PGHDR_DIRTY );
43176 pPg->flags &= ~PGHDR_NEED_SYNC;
43180 pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC);
43190 origPgno = pPg->pgno;
43191 sqlite3PcacheMove(pPg, pgno);
43192 sqlite3PcacheMakeDirty(pPg);
43240 SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
43241 assert( pPg->nRef>0 || pPg->pPager->memDb );
43242 return pPg->pData;
43249 SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){
43250 return pPg->pExtra;
43616 SQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){
43618 CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);
50474 MemPage *pPg;
50475 rc = btreeGetPage(pBt, iLastPg, &pPg, 0);
50479 rc = sqlite3PagerWrite(pPg->pDbPage);
50480 releasePage(pPg);
52493 MemPage *pPg = 0;
52496 rc = btreeGetPage(pBt, pBt->nPage, &pPg, 1);
52498 rc = sqlite3PagerWrite(pPg->pDbPage);
52499 releasePage(pPg);