int DBGP_NAME (page_wait_access) (DBGP_PARAMS it_cursor_t * itc, dp_addr_t dp, buffer_desc_t * buf_from, buffer_desc_t ** buf_ret, int mode, int max_change) { buffer_desc_t decoy; buffer_desc_t *buf; dp_addr_t phys_dp; itc->itc_to_reset = RWG_NO_WAIT; itc->itc_max_transit_change = max_change; itc->itc_must_kill_trx = 0; if (!dp) GPF_T1 ("Zero DP in page_fault_map_sem"); if (buf_from) { ITC_IN_TRANSIT (itc, dp, buf_from->bd_page); } else ASSERT_IN_MAP (itc->itc_tree, dp); buf = IT_DP_TO_BUF (itc->itc_tree, dp); if (!buf) { ra_req_t * ra = NULL; IT_DP_REMAP (itc->itc_tree, dp, phys_dp); #ifdef MTX_DEBUG em_check_dp (itc->itc_tree->it_extent_map, phys_dp); if (phys_dp != dp) em_check_dp (itc->itc_tree->it_extent_map, dp); #endif if ((DP_DELETED == phys_dp || dbs_is_free_page (itc->itc_tree->it_storage, phys_dp)) && !strchr (wi_inst.wi_open_mode, 'a')) { log_error ("Reference to page with free remap dp = %ld, remap = %ld", (long) phys_dp, (long) dp); if (0 && DBS_PAGE_IN_RANGE (itc->itc_tree->it_storage, phys_dp)) dbs_page_allocated (itc->itc_tree->it_storage, phys_dp); else { *buf_ret = PF_OF_DELETED; itc->itc_must_kill_trx = 1; itc->itc_to_reset = RWG_WAIT_ANY; ITC_LEAVE_MAPS (itc); return RWG_WAIT_ANY; } } memset (&decoy, 0, sizeof (buffer_desc_t)); decoy.bd_being_read = 1; if (PA_READ == mode) decoy.bd_readers = 1; else BD_SET_IS_WRITE (&decoy, 1); sethash (DP_ADDR2VOID (dp), &IT_DP_MAP (itc->itc_tree, dp)->itm_dp_to_buf, (void*)&decoy); ITC_LEAVE_MAPS (itc); buf = bp_get_buffer (NULL, BP_BUF_REQUIRED); is_read_pending++; buf->bd_being_read = 1; buf->bd_page = dp; buf->bd_storage = itc->itc_tree->it_storage; buf->bd_physical_page = phys_dp; BD_SET_IS_WRITE (buf, 0); buf->bd_write_waiting = NULL; if (buf_from && !itc->itc_landed) ra = itc_read_aside (itc, buf_from, dp); itc->itc_n_reads++; ITC_MARK_READ (itc); buf->bd_tree = itc->itc_tree; buf_disk_read (buf); is_read_pending--; if (ra) itc_read_ahead_blob (itc, ra, RAB_SPECULATIVE); if (buf_from) { ITC_IN_TRANSIT (itc, dp, buf_from->bd_page) } else
void it_free_dp_no_read (index_tree_t * it, dp_addr_t dp, int dp_type) { buffer_desc_t * buf; dp_addr_t phys_dp = 0; it_map_t * itm = IT_DP_MAP (it, dp); ASSERT_IN_MAP (it, dp); buf = IT_DP_TO_BUF (it, dp); if (buf) phys_dp = buf->bd_physical_page; else IT_DP_REMAP (it, dp, phys_dp); if (buf && buf->bd_being_read) { log_info ("Deleting blob page while it is being read dp=%d .\n", dp); /* the buffer can be a being read decoy with no dp, so check dps only if not being read */ } else if (phys_dp != dp) GPF_T1 ("A blob/hash temp dp is not supposed to be remapped in isp_free_blob_dp_no_read"); if (buf) { it_cursor_t itc_auto; it_cursor_t * itc = &itc_auto; ITC_INIT (itc, isp, NULL); itc_from_it (itc, it); itc->itc_itm1 = itm; /* already inside, set itc_itm1 to mark this */ /* Note that the the buf is not passed to page_wait_access. This is because of 'being read' possibility. page_fault will detect this and sync. */ page_wait_access (itc, dp, NULL, &buf, PA_WRITE, RWG_WAIT_ANY); if (PF_OF_DELETED == buf) { ITC_LEAVE_MAPS (itc); return; } if (dp_type != SHORT_REF (buf->bd_buffer + DP_FLAGS)) GPF_T1 ("About to delete non-blob page from blob page dir."); ITC_IN_KNOWN_MAP (itc, dp); /* get back in, could have come out if waited */ it_free_page (it, buf); return; } DBG_PT_PRINTF (("Free absent blob L=%d \n", dp)); { dp_addr_t remap = (dp_addr_t) (ptrlong) gethash (DP_ADDR2VOID (dp), &itm->itm_remap); dp_addr_t cpt_remap = (dp_addr_t) (ptrlong) DP_CHECKPOINT_REMAP (it->it_storage, dp); if (cpt_remap) GPF_T1 ("Blob/hash temp dp not expected to have cpt remap in delete no read"); if (DPF_BLOB == dp_type) it->it_n_blob_est--; if (remap) { /* if this was CREATED AND DELETED without intervening checkpoint the delete * does not carry outside commit space. */ remhash (DP_ADDR2VOID (dp), &itm->itm_remap); em_free_dp (it->it_extent_map, dp, DPF_BLOB == dp_type ? EXT_BLOB : EXT_INDEX); } else { if (DPF_HASH == dp_type) GPF_T1 ("a hash temp page is not supposed to be in cpt s[space"); sethash (DP_ADDR2VOID (dp), &itm->itm_remap, (void *) (ptrlong) DP_DELETED); } } }