summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-02-19 11:38:17 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-02-19 11:38:17 +1100
commit2597ba06643b86c9cba08860ff9a1744374081f9 (patch)
tree01a08261b53eca64561042280d093577c12b96a5
parent2de864a1a95dc2b68d6e072ffddcbb247e2bead9 (diff)
parent7b2c929ebd9ee434bfc3d6206536ac3ad5a9b063 (diff)
downloadmongo-2597ba06643b86c9cba08860ff9a1744374081f9.tar.gz
Merge pull request #1685 from wiredtiger/mongo-eviction-keith
Mongo eviction whitespace, minor cleanup.
-rw-r--r--src/btree/bt_page.c12
-rw-r--r--src/include/btree.i18
2 files changed, 15 insertions, 15 deletions
diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c
index c64ad6bae8d..2f2ce4cf4f7 100644
--- a/src/btree/bt_page.c
+++ b/src/btree/bt_page.c
@@ -32,14 +32,11 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags)
return (0);
/* Leaf pages only. */
- if (page->type != WT_PAGE_COL_FIX &&
- page->type != WT_PAGE_COL_VAR &&
- page->type != WT_PAGE_ROW_LEAF)
+ if (WT_PAGE_IS_INTERNAL(page))
return (0);
/* Eviction may be turned off. */
- if (LF_ISSET(WT_READ_NO_EVICT) ||
- F_ISSET(btree, WT_BTREE_NO_EVICTION))
+ if (LF_ISSET(WT_READ_NO_EVICT) || F_ISSET(btree, WT_BTREE_NO_EVICTION))
return (0);
/*
@@ -53,10 +50,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags)
__wt_page_evict_soon(page);
/* If eviction cannot succeed, don't try. */
- if (!__wt_page_can_evict(session, page, 1))
- return (0);
-
- return (1);
+ return (__wt_page_can_evict(session, page, 1));
}
/*
diff --git a/src/include/btree.i b/src/include/btree.i
index dde9c2717fd..a4b7f0d213e 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -945,8 +945,7 @@ __wt_ref_info(WT_SESSION_IMPL *session,
* Check whether a page can be evicted.
*/
static inline int
-__wt_page_can_evict(
- WT_SESSION_IMPL *session, WT_PAGE *page, int check_splits)
+__wt_page_can_evict(WT_SESSION_IMPL *session, WT_PAGE *page, int check_splits)
{
WT_BTREE *btree;
WT_PAGE_MODIFY *mod;
@@ -955,6 +954,13 @@ __wt_page_can_evict(
mod = page->modify;
/*
+ * It's unlikely we'd be here with a clean page, but in that case, we're
+ * done, it can be evicted.
+ */
+ if (mod == NULL)
+ return (0);
+
+ /*
* If the tree was deepened, there's a requirement that newly created
* internal pages not be evicted until all threads are known to have
* exited the original page index array, because evicting an internal
@@ -963,7 +969,7 @@ __wt_page_can_evict(
* a transaction value, once that's globally visible, we know we can
* evict the created page.
*/
- if (WT_PAGE_IS_INTERNAL(page) && mod != NULL &&
+ if (WT_PAGE_IS_INTERNAL(page) &&
!__wt_txn_visible_all(session, mod->mod_split_txn))
return (0);
@@ -987,7 +993,7 @@ __wt_page_can_evict(
* internal page acquires hazard pointers on child pages it reads, and
* is blocked by the exclusive lock.
*/
- if (mod != NULL && btree->checkpointing &&
+ if (btree->checkpointing &&
(__wt_page_is_modified(page) ||
F_ISSET(mod, WT_PM_REC_MULTIBLOCK))) {
WT_STAT_FAST_CONN_INCR(session, cache_eviction_checkpoint);
@@ -999,7 +1005,7 @@ __wt_page_can_evict(
* If we aren't (potentially) doing eviction that can restore updates
* and the updates on this page are too recent, give up.
*/
- if (page->read_gen != WT_READGEN_OLDEST && mod != NULL &&
+ if (page->read_gen != WT_READGEN_OLDEST &&
!__wt_txn_visible_all(session, __wt_page_is_modified(page) ?
mod->update_txn : mod->rec_max_txn))
return (0);
@@ -1008,7 +1014,7 @@ __wt_page_can_evict(
* If the page was recently split in-memory, don't force it out: we
* hope eviction will find it first.
*/
- if (check_splits && mod != NULL &&
+ if (check_splits &&
!__wt_txn_visible_all(session, mod->inmem_split_txn))
return (0);