| 4483 | |
| 4484 | |
| 4485 | static 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 | |
| 4529 | static void prefetch_prologue(Prefetch* prefetch, SLONG* start_page) |
no test coverage detected