Why "depth" to the underlying function (especially since one of them ignores it), do the depth processing/counting in __merge_walk.

Also, __merge_walk only takes a WT_VISIT_STATE pointer, why pass around voids?

Here's what I'd suggest:

```
diff --git a/src/btree/bt_merge.c b/src/btree/bt_merge.c
index 94f93e9..aaee711 100644
--- a/src/btree/bt_merge.c
+++ b/src/btree/bt_merge.c
@@ -8,18 +8,37 @@
 #include "wt_internal.h"
 
 /*
+ * WT_VISIT_STATE --
+ *     The state maintained across calls to the "visit" callback functions:
+ *     the number of refs visited, the maximum depth, and the current page and
+ *     reference when moving reference into the new tree.
+ */
+typedef struct {
+       WT_PAGE *current, *lchild, *rchild;     /* New pages to be populated. */
+       WT_REF *ref;                            /* Current insert point. */
+
+       uint32_t refcnt, split;                 /* Ref count, split point. */
+       uint32_t first_live, last_live;         /* First/last in-memory ref. */
+       u_int maxdepth;                         /* Maximum subtree depth. */
+       int seen_live;                          /* Has a ref been live? */
+} WT_VISIT_STATE;
+
+/*
  * __merge_walk --
  *     Visit all of the child references in a locked subtree and apply a
  *     callback function to them.
  */
 static int
 __merge_walk(WT_SESSION_IMPL *session, WT_PAGE *page, u_int depth,
-       int (*visit)(WT_REF *, u_int, void *), void *cookie)
+       int (*visit)(WT_REF *, WT_VISIT_STATE *), WT_VISIT_STATE *state)
 {
        WT_PAGE *child;
        WT_REF *ref;
        uint32_t i;
 
+       if (depth > state->maxdepth)
+               state->maxdepth = depth;
+
        WT_REF_FOREACH(page, ref, i)
                switch (ref->state) {
                case WT_REF_LOCKED:
@@ -35,14 +54,14 @@ __merge_walk(WT_SESSION_IMPL *session, WT_PAGE *page, u_int depth,
                            child->modify != NULL &&
                            F_ISSET(child->modify, WT_PM_REC_SPLIT_MERGE)) {
                                WT_RET(__merge_walk(
-                                   session, child, depth + 1, visit, cookie));
+                                   session, child, depth + 1, visit, state));
                                break;
                        }
                        /* FALLTHROUGH */
 
                case WT_REF_DELETED:
                case WT_REF_DISK:
-                       WT_RET((*visit)(ref, depth, cookie));
+                       WT_RET((*visit)(ref, state));
                        break;
 
                case WT_REF_EVICT_FORCE:
@@ -56,35 +75,13 @@ __merge_walk(WT_SESSION_IMPL *session, WT_PAGE *page, u_int depth,
 }
 
 /*
- * WT_VISIT_STATE --
- *     The state maintained across calls to the "visit" callback functions:
- *     the number of refs visited, the maximum depth, and the current page and
- *     reference when moving reference into the new tree.
- */
-typedef struct {
-       WT_PAGE *current, *lchild, *rchild;     /* New pages to be populated. */
-       WT_REF *ref;                            /* Current insert point. */
-
-       uint32_t refcnt, split;                 /* Ref count, split point. */
-       uint32_t first_live, last_live;         /* First/last in-memory ref. */
-       u_int maxdepth;                         /* Maximum subtree depth. */
-       int seen_live;                          /* Has a ref been live? */
-} WT_VISIT_STATE;
-
-/*
  * __merge_count --
  *     A callback function that counts the number of references as well as
  *     the first/last "live" reference.
  */
 static int
-__merge_count(WT_REF *ref, u_int depth, void *cookie)
+__merge_count(WT_REF *ref, WT_VISIT_STATE *state)
 {
-       WT_VISIT_STATE *state;
-
-       state = cookie;
-
-       if (depth > state->maxdepth)
-               state->maxdepth = depth;
        if (ref->state == WT_REF_LOCKED) {
                if (!state->seen_live)
                        state->first_live = state->refcnt;
@@ -103,13 +100,9 @@ __merge_count(WT_REF *ref, u_int depth, void *cookie)
  *     Move a child ref from the locked subtree to a new page.
  */
 static int
-__merge_move_ref(WT_REF *ref, u_int depth, void *cookie)
+__merge_move_ref(WT_REF *ref, WT_VISIT_STATE *state)
 {
        WT_REF *newref;
-       WT_VISIT_STATE *state;
-
-       WT_UNUSED(depth);
-       state = cookie;
 
        if (state->split != 0 && state->refcnt++ == state->split) {
                state->current = state->rchild;
```