本文整理汇总了C++中WT_BM::free方法的典型用法代码示例。如果您正苦于以下问题:C++ WT_BM::free方法的具体用法?C++ WT_BM::free怎么用?C++ WT_BM::free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_BM
的用法示例。
在下文中一共展示了WT_BM::free方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
/*
* __wt_rec_track_wrapup_err --
* Resolve the page's list of tracked objects after an error occurs.
*/
int
__wt_rec_track_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page)
{
WT_BM *bm;
WT_DECL_RET;
WT_PAGE_MODIFY *mod;
WT_PAGE_TRACK *track;
uint32_t i;
bm = session->btree->bm;
/*
* After a failed reconciliation of a page, discard entries added in the
* current reconciliation, their information is incorrect, additionally,
* clear the in-use flag in preparation for the next reconciliation.
*/
mod = page->modify;
for (track = mod->track, i = 0; i < mod->track_entries; ++track, ++i)
if (F_ISSET(track, WT_TRK_JUST_ADDED)) {
/*
* The in-use flag is used to avoid discarding backing
* blocks: if an object is both just-added and in-use,
* we allocated the blocks on this run, and we want to
* discard them on error.
*/
if (F_ISSET(track, WT_TRK_INUSE))
WT_TRET(bm->free(bm, session,
track->addr.addr, track->addr.size));
__wt_free(session, track->addr.addr);
memset(track, 0, sizeof(*track));
} else
F_CLR(track, WT_TRK_INUSE);
return (ret);
}
示例2:
/*
* __ovfl_reuse_wrapup_err --
* Resolve the page's overflow reuse list after an error occurs.
*/
static int
__ovfl_reuse_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page)
{
WT_BM *bm;
WT_DECL_RET;
WT_OVFL_REUSE **e, **head, *reuse;
size_t decr;
int i;
bm = S2BT(session)->bm;
head = page->modify->ovfl_track->ovfl_reuse;
/*
* Discard any overflow records that were just added, freeing underlying
* blocks.
*
* First, walk the overflow reuse lists (except for the lowest one),
* fixing up skiplist links.
*/
for (i = WT_SKIP_MAXDEPTH - 1; i > 0; --i)
for (e = &head[i]; (reuse = *e) != NULL;) {
if (!F_ISSET(reuse, WT_OVFL_REUSE_JUST_ADDED)) {
e = &reuse->next[i];
continue;
}
*e = reuse->next[i];
}
/*
* Second, discard any overflow record with a just-added flag, clear the
* flags for the next run.
*/
decr = 0;
for (e = &head[0]; (reuse = *e) != NULL;) {
if (!F_ISSET(reuse, WT_OVFL_REUSE_JUST_ADDED)) {
F_CLR(reuse, WT_OVFL_REUSE_INUSE);
e = &reuse->next[0];
continue;
}
*e = reuse->next[0];
if (WT_VERBOSE_ISSET(session, WT_VERB_OVERFLOW))
WT_RET(
__ovfl_reuse_verbose(session, page, reuse, "free"));
WT_TRET(bm->free(
bm, session, WT_OVFL_REUSE_ADDR(reuse), reuse->addr_size));
decr += WT_OVFL_SIZE(reuse, WT_OVFL_REUSE);
__wt_free(session, reuse);
}
if (decr != 0)
__wt_cache_page_inmem_decr(session, page, decr);
return (0);
}
示例3:
/*
* __wt_ovfl_discard --
* Discard an on-page overflow value, and reset the page's cell.
*/
int
__wt_ovfl_discard(WT_SESSION_IMPL *session, WT_CELL *cell)
{
WT_BM *bm;
WT_BTREE *btree;
WT_CELL_UNPACK *unpack, _unpack;
WT_DECL_RET;
btree = S2BT(session);
bm = btree->bm;
unpack = &_unpack;
__wt_cell_unpack(cell, unpack);
/*
* Finally remove overflow key/value objects, called when reconciliation
* finishes after successfully writing a page.
*
* Keys must have already been instantiated and value objects must have
* already been cached (if they might potentially still be read by any
* running transaction).
*
* Acquire the overflow lock to avoid racing with a thread reading the
* backing overflow blocks.
*/
WT_RET(__wt_writelock(session, btree->ovfl_lock));
switch (unpack->raw) {
case WT_CELL_KEY_OVFL:
__wt_cell_type_reset(session,
unpack->cell, WT_CELL_KEY_OVFL, WT_CELL_KEY_OVFL_RM);
break;
case WT_CELL_VALUE_OVFL:
__wt_cell_type_reset(session,
unpack->cell, WT_CELL_VALUE_OVFL, WT_CELL_VALUE_OVFL_RM);
break;
WT_ILLEGAL_VALUE(session);
}
WT_TRET(__wt_writeunlock(session, btree->ovfl_lock));
/* Free the backing disk blocks. */
WT_TRET(bm->free(bm, session, unpack->data, unpack->size));
return (ret);
}