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

Function prefetch_io

src/jrd/cch.cpp:4485–4526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4483
4484
4485static void prefetch_io(Prefetch* prefetch, FbStatusVector* status_vector)
4486{
4487/**************************************
4488 *
4489 * p r e f e t c h _ i o
4490 *
4491 **************************************
4492 *
4493 * Functional description
4494 * Queue an asynchronous I/O to read
4495 * multiple pages into prefetch buffer.
4496 *
4497 **************************************/
4498 thread_db* tdbb = prefetch->prf_tdbb;
4499 Database* dbb = tdbb->getDatabase();
4500
4501 if (!prefetch->prf_page_count)
4502 prefetch->prf_flags &= ~PRF_active;
4503 else
4504 {
4505 // Get the cache reader working on our behalf too
4506
4507 if (!(dbb->dbb_bcb->bcb_flags & BCB_reader_active))
4508 dbb->dbb_reader_sem.post();
4509
4510 const bool async_status =
4511 PIO_read_ahead(dbb, prefetch->prf_start_page, prefetch->prf_io_buffer,
4512 prefetch->prf_page_count, &prefetch->prf_piob, status_vector);
4513 if (!async_status)
4514 {
4515 BufferDesc** next_bdb = prefetch->prf_bdbs;
4516 for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++)
4517 {
4518 if (*next_bdb)
4519 release_bdb(tdbb, *next_bdb, true, false, false);
4520
4521 next_bdb++;
4522 }
4523 prefetch->prf_flags &= ~PRF_active;
4524 }
4525 }
4526}
4527
4528
4529static void prefetch_prologue(Prefetch* prefetch, SLONG* start_page)

Callers 3

CCH_prefetchFunction · 0.85
cache_readerMethod · 0.85
cache_writerMethod · 0.85

Calls 2

PIO_read_aheadFunction · 0.85
getDatabaseMethod · 0.80

Tested by

no test coverage detected