diff options
author | Keith Bostic <keith@wiredtiger.com> | 2012-02-27 10:56:52 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2012-02-27 10:56:52 -0500 |
commit | a6ab15c8a17c099bcf3ea9d9cafd5616192fc7ca (patch) | |
tree | d7d6f75278a3e70807864e5dc86f25d9ac198451 | |
parent | 976c5d2fdcda446b27d00b77d838193560044200 (diff) | |
download | mongo-a6ab15c8a17c099bcf3ea9d9cafd5616192fc7ca.tar.gz |
Group the exclusive-access functions together (no real change, just shifting
a couple of functions around for clarity).
-rw-r--r-- | src/btree/rec_evict.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/btree/rec_evict.c b/src/btree/rec_evict.c index f9bfb01c380..facc688c166 100644 --- a/src/btree/rec_evict.c +++ b/src/btree/rec_evict.c @@ -283,6 +283,70 @@ __rec_root_dirty_update(WT_SESSION_IMPL *session, WT_PAGE *page) } /* + * __rec_discard -- + * Discard any pages merged into an evicted page, then the page itself. + */ +static int +__rec_discard(WT_SESSION_IMPL *session, WT_PAGE *page) +{ + WT_REF *ref; + uint32_t i; + + switch (page->type) { + case WT_PAGE_COL_INT: + case WT_PAGE_ROW_INT: + /* For each entry in the page... */ + WT_REF_FOREACH(page, ref, i) + if (ref->state != WT_REF_DISK) + WT_RET(__rec_discard(session, ref->page)); + /* FALLTHROUGH */ + default: + WT_RET(__rec_discard_page(session, page)); + break; + } + return (0); +} + +/* + * __rec_discard_page -- + * Process the page's list of tracked objects, and discard it. + */ +static int +__rec_discard_page(WT_SESSION_IMPL *session, WT_PAGE *page) +{ + WT_PAGE_MODIFY *mod; + + mod = page->modify; + + /* + * or if the page was split and later merged, discard it. + */ + if (mod != NULL) { + /* + * If the page has been modified and was tracking objects, + * resolve them. + */ + WT_RET(__wt_rec_track_wrapup(session, page, 1)); + + /* + * If the page was split and eventually merged into the parent, + * discard the split page; if the split page was promoted into + * a split-merge page, then the reference must be cleared before + * the page is discarded. + */ + if (F_ISSET( + page, WT_PAGE_REC_MASK) == WT_PAGE_REC_SPLIT && + mod->u.split != NULL) + __wt_page_out(session, mod->u.split, 0); + } + + /* Discard the page itself. */ + __wt_page_out(session, page, 0); + + return (0); +} + +/* * __rec_excl -- * Get exclusive access to the page and review the page and its subtree * for conditions that would block our eviction of the page. @@ -382,70 +446,6 @@ __rec_excl_clear(WT_SESSION_IMPL *session) } /* - * __rec_discard -- - * Discard any pages merged into an evicted page, then the page itself. - */ -static int -__rec_discard(WT_SESSION_IMPL *session, WT_PAGE *page) -{ - WT_REF *ref; - uint32_t i; - - switch (page->type) { - case WT_PAGE_COL_INT: - case WT_PAGE_ROW_INT: - /* For each entry in the page... */ - WT_REF_FOREACH(page, ref, i) - if (ref->state != WT_REF_DISK) - WT_RET(__rec_discard(session, ref->page)); - /* FALLTHROUGH */ - default: - WT_RET(__rec_discard_page(session, page)); - break; - } - return (0); -} - -/* - * __rec_discard_page -- - * Process the page's list of tracked objects, and discard it. - */ -static int -__rec_discard_page(WT_SESSION_IMPL *session, WT_PAGE *page) -{ - WT_PAGE_MODIFY *mod; - - mod = page->modify; - - /* - * or if the page was split and later merged, discard it. - */ - if (mod != NULL) { - /* - * If the page has been modified and was tracking objects, - * resolve them. - */ - WT_RET(__wt_rec_track_wrapup(session, page, 1)); - - /* - * If the page was split and eventually merged into the parent, - * discard the split page; if the split page was promoted into - * a split-merge page, then the reference must be cleared before - * the page is discarded. - */ - if (F_ISSET( - page, WT_PAGE_REC_MASK) == WT_PAGE_REC_SPLIT && - mod->u.split != NULL) - __wt_page_out(session, mod->u.split, 0); - } - - /* Discard the page itself. */ - __wt_page_out(session, page, 0); - - return (0); -} - -/* * __hazard_exclusive -- * Request exclusive access to a page. */ |