MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / requeueRecentlyUsed

Function requeueRecentlyUsed

src/jrd/cch.cpp:5122–5161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5120
5121
5122void requeueRecentlyUsed(BufferControl* bcb)
5123{
5124 BufferDesc* chain = NULL;
5125
5126 // Let's pick up the LRU pending chain, if any
5127
5128 for (;;)
5129 {
5130 chain = bcb->bcb_lru_chain;
5131 if (bcb->bcb_lru_chain.compare_exchange_strong(chain, NULL))
5132 break;
5133 }
5134
5135 if (!chain)
5136 return;
5137
5138 // Next, let's flip the order
5139
5140 BufferDesc* reversed = NULL;
5141 BufferDesc* bdb;
5142
5143 while ((bdb = chain) != NULL)
5144 {
5145 chain = bdb->bdb_lru_chain;
5146 bdb->bdb_lru_chain = reversed;
5147 reversed = bdb;
5148 }
5149
5150 while ((bdb = reversed) != NULL)
5151 {
5152 reversed = bdb->bdb_lru_chain;
5153 QUE_DELETE(bdb->bdb_in_use);
5154 QUE_INSERT(bcb->bcb_in_use, bdb->bdb_in_use);
5155
5156 bdb->bdb_lru_chain = NULL;
5157 bdb->bdb_flags &= ~BDB_lru_chained;
5158 }
5159
5160 chain = bcb->bcb_lru_chain;
5161}
5162
5163
5164BufferControl* BufferControl::create(Database* dbb)

Callers 5

CCH_clean_pageFunction · 0.85
CCH_forget_pageFunction · 0.85
CCH_releaseFunction · 0.85
get_dirty_bufferFunction · 0.85
get_oldest_bufferFunction · 0.85

Calls 3

QUE_DELETEFunction · 0.85
QUE_INSERTFunction · 0.85

Tested by

no test coverage detected