diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2011-03-07 12:06:47 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2011-03-07 12:06:47 +1100 |
commit | 7b12b5e3129bb76e62b833ac3409f5f6020a9ffa (patch) | |
tree | 332aa2d48360b16527ee31592ed890401c40f068 | |
parent | db143f5cf256ab96faddead508d74cf71eb92d97 (diff) | |
download | mongo-7b12b5e3129bb76e62b833ac3409f5f6020a9ffa.tar.gz |
Formatting, mostly whitespace (s_longlines).
42 files changed, 286 insertions, 212 deletions
diff --git a/dist/s_longlines b/dist/s_longlines index dc5afe9abd0..8b6ced0e7f3 100644 --- a/dist/s_longlines +++ b/dist/s_longlines @@ -7,7 +7,7 @@ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 l=`(sed -e '/^[a-z]/! d' -e 's,^,../,' filelist ; ls ../src/include/*.h ../src/include/*.in) | egrep -v 'src/api/(api|pack)\.c$' | - egrep -v '.*/api_int\.c$|support/stat\.c$'` + egrep -v 'include/api\.h|.*/api_int\.c$|support/stat\.c$'` for f in $l ; do # awk's length function appears to include the newline, hence "> 81" diff --git a/dist/serial.py b/dist/serial.py index 2b19d0f7043..f61fbaa95b3 100644 --- a/dist/serial.py +++ b/dist/serial.py @@ -75,11 +75,11 @@ def func_serial(f): for l in entry[1].args: f.write(', _' + l.split('/')[1]) f.write(') do {\\\n') + f.write('\t__wt_' + entry[0] + '_args *_args =\\\n ') + f.write('(__wt_' + entry[0] + '_args *)(session)->wq_args;\\\n') for l in entry[1].args: f.write('\t_' + l.split('/')[1] + - ' = ((__wt_' + entry[0] + - '_args *)(session)->wq_args)->' + - l.split('/')[1] + ';\\\n') + ' = _args->' + l.split('/')[1] + ';\\\n') f.write('} while (0)\n') ##################################################################### diff --git a/src/btree/bt_bulk.c b/src/btree/bt_bulk.c index 249a59cf5e5..b5cde2e5367 100644 --- a/src/btree/bt_bulk.c +++ b/src/btree/bt_bulk.c @@ -26,7 +26,8 @@ static int __wt_item_build_key(SESSION *, WT_ITEM *, WT_CELL *, WT_OVFL *); */ int __wt_btree_bulk_load(SESSION *session, - void (*f)(const char *, uint64_t), int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) + void (*f)(const char *, uint64_t), + int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) { BTREE *btree; uint32_t addr; @@ -61,7 +62,8 @@ __wt_btree_bulk_load(SESSION *session, */ static int __wt_bulk_fix(SESSION *session, - void (*f)(const char *, uint64_t), int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) + void (*f)(const char *, uint64_t), + int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) { BTREE *btree; WT_ITEM *key, *data; @@ -152,7 +154,8 @@ __wt_bulk_fix(SESSION *session, WT_ERR(__wt_page_write(session, page)); dsk->u.entries = 0; dsk->recno = insert_cnt; - WT_ERR(__wt_block_alloc(session, &page->addr, btree->leafmin)); + WT_ERR(__wt_block_alloc(session, + &page->addr, btree->leafmin)); __wt_init_ff_and_sa(page, &first_free, &space_avail); } ++dsk->u.entries; @@ -202,7 +205,8 @@ err: WT_TRET(__wt_bulk_stack_put(session, &stack)); */ static int __wt_bulk_var(SESSION *session, - void (*f)(const char *, uint64_t), int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) + void (*f)(const char *, uint64_t), + int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)) { BTREE *btree; WT_ITEM *key, *value, key_copy, value_copy; @@ -509,7 +513,8 @@ __wt_bulk_var_insert(ICURSOR_BULK *cbulk) * to its parent and discard it, then switch to the new * page. */ - WT_RET(__wt_bulk_promote(session, cbulk->page, &cbulk->stack, 0)); + WT_RET(__wt_bulk_promote(session, + cbulk->page, &cbulk->stack, 0)); WT_RET(__wt_page_write(session, cbulk->page)); __wt_scr_release(&cbulk->tmp); @@ -567,7 +572,8 @@ __wt_bulk_end(ICURSOR_BULK *cbulk) /* Promote a key from any partially-filled page and write it. */ if (cbulk->page->dsk->u.entries != 0) { - WT_ERR(__wt_bulk_promote(session, cbulk->page, &cbulk->stack, 0)); + WT_ERR(__wt_bulk_promote(session, + cbulk->page, &cbulk->stack, 0)); WT_ERR(__wt_page_write(session, cbulk->page)); } @@ -615,7 +621,7 @@ __wt_bulk_promote(SESSION *session, WT_PAGE *page, WT_STACK *stack, u_int level) /* * If it's a row-store, get a copy of the first item on the page -- it * might be an overflow item, in which case we need to make a copy for - * the parent. Most versions of Berkeley BTREE tried to reference count + * the parent. Most versions of Berkeley DB tried to reference count * overflow items if they were promoted to internal pages. That turned * out to be hard to get right, so I'm not doing it again. * @@ -896,7 +902,8 @@ __wt_item_build_key(SESSION *session, WT_ITEM *dbt, WT_CELL *item, WT_OVFL *ovfl /* * We're called with a WT_ITEM that references a data/size pair. We can * re-point that WT_ITEM's data and size fields to other memory, but we - * cannot allocate memory in that WT_ITEM -- all we can do is re-point it. + * cannot allocate memory in that WT_ITEM -- all we can do is re-point + * it. * * For Huffman-encoded key/data items, we need a chunk of new space; * use the SESSION key/data return memory: this routine is called during @@ -905,11 +912,11 @@ __wt_item_build_key(SESSION *session, WT_ITEM *dbt, WT_CELL *item, WT_OVFL *ovfl /* Optionally compress the data using the Huffman engine. */ if (btree->huffman_key != NULL) { - WT_RET(__wt_huffman_encode( - btree->huffman_key, dbt->data, dbt->size, &session->key)); + WT_RET(__wt_huffman_encode(btree->huffman_key, + dbt->data, dbt->size, &session->key)); if (session->key.item.size > dbt->size) - WT_STAT_INCRV(stats, - FILE_HUFFMAN_KEY, session->key.item.size - dbt->size); + WT_STAT_INCRV(stats, FILE_HUFFMAN_KEY, + session->key.item.size - dbt->size); *dbt = session->key.item; } @@ -944,7 +951,8 @@ __wt_item_build_value(SESSION *session, /* * We're called with a WT_ITEM that references a data/size pair. We can * re-point that WT_ITEM's data and size fields to other memory, but we - * cannot allocate memory in that WT_ITEM -- all we can do is re-point it. + * cannot allocate memory in that WT_ITEM -- all we can do is re-point + * it. * * For Huffman-encoded key/data items, we need a chunk of new space; * use the SESSION key/data return memory: this routine is called during @@ -964,11 +972,11 @@ __wt_item_build_value(SESSION *session, /* Optionally compress the data using the Huffman engine. */ if (btree->huffman_data != NULL) { - WT_RET(__wt_huffman_encode( - btree->huffman_data, dbt->data, dbt->size, &session->value)); + WT_RET(__wt_huffman_encode(btree->huffman_data, + dbt->data, dbt->size, &session->value)); if (session->value.item.size > dbt->size) - WT_STAT_INCRV(stats, - FILE_HUFFMAN_DATA, session->value.item.size - dbt->size); + WT_STAT_INCRV(stats, FILE_HUFFMAN_DATA, + session->value.item.size - dbt->size); *dbt = session->value.item; } diff --git a/src/btree/bt_cache.c b/src/btree/bt_cache.c index 671cc8c503c..8ea163ef157 100644 --- a/src/btree/bt_cache.c +++ b/src/btree/bt_cache.c @@ -25,10 +25,12 @@ __wt_cache_create(CONNECTION *conn) WT_RET(__wt_calloc_def(session, 1, &conn->cache)); cache = conn->cache; - WT_ERR( - __wt_mtx_alloc(session, "cache eviction server", 1, &cache->mtx_evict)); - WT_ERR(__wt_mtx_alloc(session, "cache read server", 1, &cache->mtx_read)); - WT_ERR(__wt_mtx_alloc(session, "reconciliation", 0, &cache->mtx_reconcile)); + WT_ERR(__wt_mtx_alloc(session, + "cache eviction server", 1, &cache->mtx_evict)); + WT_ERR(__wt_mtx_alloc(session, + "cache read server", 1, &cache->mtx_read)); + WT_ERR(__wt_mtx_alloc(session, + "reconciliation", 0, &cache->mtx_reconcile)); WT_ERR(__wt_stat_alloc_cache_stats(session, &cache->stats)); diff --git a/src/btree/bt_cmp.c b/src/btree/bt_cmp.c index 5a85213b1da..1137b4afbf6 100644 --- a/src/btree/bt_cmp.c +++ b/src/btree/bt_cmp.c @@ -12,7 +12,8 @@ * Lexicographic comparison routine. */ int -__wt_bt_lex_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_dbt) +__wt_bt_lex_compare( + BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) { uint32_t len; const uint8_t *userp, *treep; @@ -25,23 +26,23 @@ __wt_bt_lex_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_d /* * Return: - * < 0 if user_dbt is lexicographically < tree_dbt - * = 0 if user_dbt is lexicographically = tree_dbt - * > 0 if user_dbt is lexicographically > tree_dbt + * < 0 if user_item is lexicographically < tree_item + * = 0 if user_item is lexicographically = tree_item + * > 0 if user_item is lexicographically > tree_item * * We use the names "user" and "tree" so it's clear which the * application is looking at when we call its comparison func. */ - if ((len = user_dbt->size) > tree_dbt->size) - len = tree_dbt->size; - for (userp = user_dbt->data, - treep = tree_dbt->data; len > 0; --len, ++userp, ++treep) + if ((len = user_item->size) > tree_item->size) + len = tree_item->size; + for (userp = user_item->data, + treep = tree_item->data; len > 0; --len, ++userp, ++treep) if (*userp != *treep) return (*userp < *treep ? -1 : 1); /* Contents are equal up to the smallest length. */ - return (user_dbt->size == tree_dbt->size ? 0 : - (user_dbt->size < tree_dbt->size ? -1 : 1)); + return (user_item->size == tree_item->size ? 0 : + (user_item->size < tree_item->size ? -1 : 1)); } /* @@ -49,7 +50,8 @@ __wt_bt_lex_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_d * Integer comparison routine. */ int -__wt_bt_int_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_dbt) +__wt_bt_int_compare( + BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item) { uint64_t user_int, tree_int; @@ -57,16 +59,16 @@ __wt_bt_int_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_d * The WT_ITEM must hold the low-order bits in machine integer order. * * Return: - * < 0 if user_dbt is < tree_dbt - * = 0 if user_dbt is = tree_dbt - * > 0 if user_dbt is > tree_dbt + * < 0 if user_item is < tree_item + * = 0 if user_item is = tree_item + * > 0 if user_item is > tree_item * * We use the names "user" and "tree" so it's clear which the * application is looking at when we call its comparison func. */ user_int = tree_int = 0; - memcpy(&user_int, user_dbt->data, (size_t)btree->btree_compare_int); - memcpy(&tree_int, tree_dbt->data, (size_t)btree->btree_compare_int); + memcpy(&user_int, user_item->data, (size_t)btree->btree_compare_int); + memcpy(&tree_int, tree_item->data, (size_t)btree->btree_compare_int); return (user_int == tree_int ? 0 : (user_int < tree_int ? -1 : 1)); } diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index c750c21baee..39dc7c616b8 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -80,7 +80,8 @@ __wt_debug_dump(SESSION *session, const char *ofile, FILE *fp) * Dump a disk page in debugging mode. */ int -__wt_debug_disk(SESSION *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp) +__wt_debug_disk( + SESSION *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp) { BTREE *btree; int do_close, ret; diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c index 11bb803e846..3dc3b7ba1e7 100644 --- a/src/btree/bt_discard.c +++ b/src/btree/bt_discard.c @@ -186,7 +186,8 @@ __wt_discard_page_row_leaf(SESSION *session, WT_PAGE *page) page->u.row_leaf.d, page->indx_count * sizeof(WT_ROW)); if (page->u.row_leaf.upd != NULL) - __wt_discard_update(session, page->u.row_leaf.upd, page->indx_count); + __wt_discard_update( + session, page->u.row_leaf.upd, page->indx_count); } /* @@ -194,7 +195,8 @@ __wt_discard_page_row_leaf(SESSION *session, WT_PAGE *page) * Discard the update array. */ static void -__wt_discard_update(SESSION *session, WT_UPDATE **update_head, uint32_t indx_count) +__wt_discard_update( + SESSION *session, WT_UPDATE **update_head, uint32_t indx_count) { WT_UPDATE **updp; diff --git a/src/btree/bt_dump.c b/src/btree/bt_dump.c index 8feca3196a6..c863ae2ffb6 100644 --- a/src/btree/bt_dump.c +++ b/src/btree/bt_dump.c @@ -290,8 +290,8 @@ __wt_dump_page_row_leaf(SESSION *session, WT_PAGE *page, WT_DSTUFF *dp) continue; /* - * The key and value variables reference the WT_DATAITEMs we'll print. - * Set the key. + * The key and value variables reference the items we will + * print. Set the key. */ if (__wt_key_process(rip)) { WT_ERR(__wt_item_process(session, rip->key, key_tmp)); diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c index c12ebe2528b..ae9896e9888 100644 --- a/src/btree/bt_evict.c +++ b/src/btree/bt_evict.c @@ -110,7 +110,8 @@ __wt_cache_evict_server(void *arg) /* We need a thread of control because we're reading/writing pages. */ session = NULL; - WT_ERR(__wt_session_api_set(conn, "CacheReconciliation", NULL, &session)); + WT_ERR(__wt_session_api_set(conn, + "CacheReconciliation", NULL, &session)); /* * Multiple pages are marked for eviction by the eviction server, which @@ -303,12 +304,11 @@ __wt_evict_walk(SESSION *session) i = WT_EVICT_WALK_BASE; TAILQ_FOREACH(btree, &conn->dbqh, q) { - if ((ret = __wt_evict_walk_single(session, btree, i)) != 0) - break; + WT_ERR(__wt_evict_walk_single(session, btree, i)); i += WT_EVICT_WALK_PER_TABLE; } } - __wt_unlock(session, conn->mtx); +err: __wt_unlock(session, conn->mtx); return (ret); } diff --git a/src/btree/bt_open.c b/src/btree/bt_open.c index 34a3c0e82d4..458b73713af 100644 --- a/src/btree/bt_open.c +++ b/src/btree/bt_open.c @@ -25,7 +25,8 @@ __wt_bt_open(SESSION *session, int ok_create) WT_RET(__wt_open_verify(session, btree)); /* Open the fle. */ - WT_RET(__wt_open(session, btree->name, btree->mode, ok_create, &btree->fh)); + WT_RET(__wt_open(session, + btree->name, btree->mode, ok_create, &btree->fh)); /* * If the file size is 0, write a description page; if the file size @@ -60,7 +61,8 @@ __wt_open_verify(SESSION *session, BTREE *btree) WT_RET(__wt_open_verify_page_sizes(session, btree)); /* Verify other configuration combinations. */ - if (btree->fixed_len != 0 && (btree->huffman_key || btree->huffman_data)) { + if (btree->fixed_len != 0 && + (btree->huffman_key || btree->huffman_data)) { __wt_err(session, 0, "Fixed-size column-store files may not be Huffman encoded"); return (WT_ERROR); @@ -130,7 +132,8 @@ __wt_open_verify_page_sizes(SESSION *session, BTREE *btree) if (btree->intlmin == 0) btree->intlmin = WT_BTREE_INTLMIN_DEFAULT; if (btree->intlmax == 0) - btree->intlmax = WT_MAX(btree->intlmin, WT_BTREE_INTLMAX_DEFAULT); + btree->intlmax = + WT_MAX(btree->intlmin, WT_BTREE_INTLMAX_DEFAULT); if (btree->intlitemsize == 0) { if (btree->intlmin <= 1024) btree->intlitemsize = 50; @@ -156,7 +159,8 @@ __wt_open_verify_page_sizes(SESSION *session, BTREE *btree) if (btree->leafmin == 0) btree->leafmin = WT_BTREE_LEAFMIN_DEFAULT; if (btree->leafmax == 0) - btree->leafmax = WT_MAX(btree->leafmin, WT_BTREE_LEAFMAX_DEFAULT); + btree->leafmax = + WT_MAX(btree->leafmin, WT_BTREE_LEAFMAX_DEFAULT); if (btree->leafitemsize == 0) { if (btree->leafmin <= 4096) btree->leafitemsize = 80; @@ -206,7 +210,7 @@ __wt_open_verify_page_sizes(SESSION *session, BTREE *btree) * whole btree thing breaks down because we can't split. We have * to include WT_DESC_SIZE in leaf page calculations, it's not * strictly necessary in internal pages because page 0 is always - * a leaf page. The additional 10 bytes is for slop -- Berkeley BTREE + * a leaf page. The additional 10 bytes is for slop -- Berkeley DB * took roughly a decade to get the calculation correct, and that * way I can skip the suspense. */ diff --git a/src/btree/bt_ovfl.c b/src/btree/bt_ovfl.c index 8fefa99b56b..1e9b1d427d9 100644 --- a/src/btree/bt_ovfl.c +++ b/src/btree/bt_ovfl.c @@ -46,9 +46,9 @@ __wt_ovfl_in(SESSION *session, WT_OVFL *ovfl, WT_BUF *store) * buffer and so should be fast, but it's still not a good thing. If * it ever becomes a problem, then we either have to pass the fact that * it's a "page" back to our caller and let them deal with the offset, - * or add a new field to the WT_ITEM that flags the start of the allocated - * buffer, instead of using the "data" field to indicate both the start - * of the data and the start of the allocated memory. + * or add a new field to the WT_ITEM that flags the start of the + * allocated buffer, instead of using the "data" field to indicate both + * the start of the data and the start of the allocated memory. * * Re-allocate memory as necessary to hold the overflow pages. */ diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index f86a73168a3..c7ec1cbadc3 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -135,8 +135,8 @@ __wt_page_inmem_col_fix(SESSION *session, WT_PAGE *page) * Column-store page entries map one-to-one to the number of physical * entries on the page (each physical entry is a data item). */ - WT_RET(( - __wt_calloc_def(session, (size_t)dsk->u.entries, &page->u.col_leaf.d))); + WT_RET(__wt_calloc_def( + session, (size_t)dsk->u.entries, &page->u.col_leaf.d)); /* * Walk the page, building references: the page contains fixed-length @@ -168,8 +168,8 @@ __wt_page_inmem_col_int(SESSION *session, WT_PAGE *page) * Column-store page entries map one-to-one to the number of physical * entries on the page (each physical entry is a offset object). */ - WT_RET(( - __wt_calloc_def(session, (size_t)dsk->u.entries, &page->u.col_int.t))); + WT_RET(__wt_calloc_def( + session, (size_t)dsk->u.entries, &page->u.col_int.t)); /* * Walk the page, building references: the page contains WT_OFF_RECORD @@ -208,8 +208,8 @@ __wt_page_inmem_col_rle(SESSION *session, WT_PAGE *page) * Column-store page entries map one-to-one to the number of physical * entries on the page (each physical entry is a data item). */ - WT_RET(( - __wt_calloc_def(session, (size_t)dsk->u.entries, &page->u.col_leaf.d))); + WT_RET(__wt_calloc_def( + session, (size_t)dsk->u.entries, &page->u.col_leaf.d)); /* * Walk the page, building references: the page contains fixed-length @@ -242,8 +242,8 @@ __wt_page_inmem_col_var(SESSION *session, WT_PAGE *page) * Column-store page entries map one-to-one to the number of physical * entries on the page (each physical entry is a data item). */ - WT_RET(( - __wt_calloc_def(session, (size_t)dsk->u.entries, &page->u.col_leaf.d))); + WT_RET(__wt_calloc_def( + session, (size_t)dsk->u.entries, &page->u.col_leaf.d)); /* * Walk the page, building references: the page contains unsorted data @@ -419,10 +419,11 @@ onpage: p = WT_CELL_BYTE(item); case WT_CELL_DATA_OVFL: huffman = btree->huffman_data; offpage: /* - * It's an overflow item -- if it's not encoded, we can read - * it directly into the user's return WT_ITEM, otherwise we have to - * have our own buffer as temporary space, and the decode call - * will put a decoded version into the user's return WT_ITEM. + * It's an overflow item -- if it's not encoded, we can read it + * directly into the user's return WT_ITEM, otherwise we have + * to have our own buffer as temporary space, and the decode + * call will put a decoded version into the user's return + * WT_ITEM. */ if (huffman == NULL) tmp = scratch; diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index 534767a9721..461f8df6879 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -152,7 +152,8 @@ __wt_cache_read_server(void *arg) ret = __wt_cache_read(rr); WT_READ_REQ_CLR(rr); - __wt_session_serialize_wrapup(session, NULL, ret); + __wt_session_serialize_wrapup( + session, NULL, ret); didwork = 1; @@ -218,8 +219,8 @@ __wt_cache_read(WT_READ_REQ *rr) WT_ERR(__wt_calloc(session, (size_t)size, sizeof(uint8_t), &dsk)); /* Read the page. */ - WT_VERBOSE(S2C(session), WT_VERB_READ, - (session, "cache read addr/size %lu/%lu", (u_long)addr, (u_long)size)); + WT_VERBOSE(S2C(session), WT_VERB_READ, (session, + "cache read addr/size %lu/%lu", (u_long)addr, (u_long)size)); WT_ERR(__wt_disk_read(session, dsk, addr, size)); WT_CACHE_PAGE_IN(cache, size); diff --git a/src/btree/bt_reconcile.c b/src/btree/bt_reconcile.c index d64b1b116cb..8bc55629885 100644 --- a/src/btree/bt_reconcile.c +++ b/src/btree/bt_reconcile.c @@ -459,7 +459,8 @@ err: if (tmp != NULL) * Write a disk block out for the helper functions. */ static int -__wt_rec_helper_write(SESSION *session, int deleted, WT_PAGE_DISK *dsk, void *end) +__wt_rec_helper_write( + SESSION *session, int deleted, WT_PAGE_DISK *dsk, void *end) { WT_REC_LIST *r; struct rec_list *r_list; @@ -672,8 +673,8 @@ __wt_rec_col_rle(SESSION *session, WT_PAGE *page) * terminated array of references to WT_RLE_EXPAND structures, * sorted by record number. */ - WT_ERR( - __wt_rle_expand_sort(session, page, cip, &expsort, &n_expsort)); + WT_ERR(__wt_rle_expand_sort( + session, page, cip, &expsort, &n_expsort)); /* * @@ -1049,8 +1050,8 @@ __wt_rec_row_leaf(SESSION *session, WT_PAGE *page) */ if (WT_UPDATE_DELETED_ISSET(upd)) { if (WT_CELL_TYPE(key_item) == WT_CELL_KEY_OVFL) - WT_RET(__wt_block_free_ovfl( - session, WT_CELL_BYTE_OVFL(key_item))); + WT_RET(__wt_block_free_ovfl(session, + WT_CELL_BYTE_OVFL(key_item))); continue; } diff --git a/src/btree/bt_ret.c b/src/btree/bt_ret.c index 2541f553eaf..16c4900429f 100644 --- a/src/btree/bt_ret.c +++ b/src/btree/bt_ret.c @@ -49,13 +49,14 @@ __wt_data_return(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return) * the items into the application's WT_DATAITEMs. * * If the key/value item are uninstantiated overflow and/or compressed - * items, they require processing before being copied into the WT_DATAITEMs. - * Don't allocate WT_INDX memory for key/value items here. (We never - * allocate WT_INDX memory for data items. We do allocate WT_INDX - * memory for keys, but if we are looking at a key only to return it, - * it's not that likely to be accessed again (think of a cursor moving - * through the tree). Use memory in the application's WT_ITEM instead, it - * is discarded when the SESSION is discarded. + * items, they require processing before being copied into the + * WT_DATAITEMs. Don't allocate WT_INDX memory for key/value items + * here. (We never allocate WT_INDX memory for data items. We do + * allocate WT_INDX memory for keys, but if we are looking at a key + * only to return it, it's not that likely to be accessed again (think + * of a cursor moving through the tree). Use memory in the + * application's WT_ITEM instead, it is discarded when the SESSION is + * discarded. * * Key return implies a reference to a WT_ROW index (we don't return * record number keys yet, that will probably change when I add cursor @@ -63,7 +64,8 @@ __wt_data_return(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return) */ if (key_return) { if (__wt_key_process(rip)) { - WT_RET(__wt_item_process(session, rip->key, &session->key)); + WT_RET(__wt_item_process( + session, rip->key, &session->key)); *key = session->key.item; } else if (callback == NULL) { @@ -116,7 +118,8 @@ item_set: switch (WT_CELL_TYPE(item)) { } /* FALLTHROUGH */ case WT_CELL_DATA_OVFL: - WT_RET(__wt_item_process(session, item, &session->value)); + WT_RET(__wt_item_process( + session, item, &session->value)); value_ret = session->value.item.data; size_ret = session->value.item.size; break; @@ -139,7 +142,8 @@ item_set: switch (WT_CELL_TYPE(item)) { * WT_ITEM (potentially done by __wt_item_process), do so now. */ if (value_ret != session->value.item.data) { - WT_RET(__wt_buf_grow(session, &session->value, size_ret)); + WT_RET(__wt_buf_grow( + session, &session->value, size_ret)); memcpy(session->value.mem, value_ret, size_ret); } diff --git a/src/btree/bt_rw.c b/src/btree/bt_rw.c index e113e80edb3..46330c50bf3 100644 --- a/src/btree/bt_rw.c +++ b/src/btree/bt_rw.c @@ -12,7 +12,8 @@ * Read a file page. */ int -__wt_disk_read(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) +__wt_disk_read( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { BTREE *btree; WT_FH *fh; @@ -45,7 +46,8 @@ __wt_disk_read(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size * Write a file page. */ int -__wt_disk_write(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) +__wt_disk_write( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { BTREE *btree; WT_FH *fh; diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c index b38a96491c9..81dd78699aa 100644 --- a/src/btree/bt_sync.c +++ b/src/btree/bt_sync.c @@ -35,7 +35,8 @@ __wt_bt_sync(SESSION *session) * to reconcile pages we're flushing. */ __wt_lock(session, cache->mtx_reconcile); - ret = __wt_tree_walk(session, NULL, WT_WALK_CACHE, __wt_bt_tree_sync, NULL); + ret = __wt_tree_walk( + session, NULL, WT_WALK_CACHE, __wt_bt_tree_sync, NULL); __wt_unlock(session, cache->mtx_reconcile); return (ret); } diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 6691e3891a5..042f5982e63 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -278,7 +278,8 @@ __wt_verify_tree( * in a comparison. */ if (vs->leaf != NULL) { - WT_ERR(__wt_verify_pc(session, rref, vs->leaf, 0)); + WT_ERR(__wt_verify_pc( + session, rref, vs->leaf, 0)); __wt_hazard_clear(session, vs->leaf); vs->leaf = NULL; } @@ -534,7 +535,8 @@ __wt_verify_freelist(SESSION *session, WT_VSTUFF *vs) * verified this chunk of the file. */ static int -__wt_verify_addfrag(SESSION *session, uint32_t addr, uint32_t size, WT_VSTUFF *vs) +__wt_verify_addfrag( + SESSION *session, uint32_t addr, uint32_t size, WT_VSTUFF *vs) { BTREE *btree; uint32_t frags, i; diff --git a/src/btree/bt_vrfy_dsk.c b/src/btree/bt_vrfy_dsk.c index 8bda1ea6f66..8cbae321631 100644 --- a/src/btree/bt_vrfy_dsk.c +++ b/src/btree/bt_vrfy_dsk.c @@ -11,10 +11,14 @@ static int __wt_err_delfmt(SESSION *, uint32_t, uint32_t); static int __wt_err_eof(SESSION *, uint32_t, uint32_t); static int __wt_err_eop(SESSION *, uint32_t, uint32_t); -static int __wt_verify_dsk_col_fix(SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); -static int __wt_verify_dsk_col_int(SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); -static int __wt_verify_dsk_col_rle(SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); -static int __wt_verify_dsk_item(SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); +static int __wt_verify_dsk_col_fix( + SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); +static int __wt_verify_dsk_col_int( + SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); +static int __wt_verify_dsk_col_rle( + SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); +static int __wt_verify_dsk_item( + SESSION *, WT_PAGE_DISK *, uint32_t, uint32_t); /* * __wt_verify_dsk_page -- @@ -312,8 +316,8 @@ item_len: __wt_errx(session, } if (__wt_key_process(rip)) { - WT_RET( - __wt_item_process(session, rip->key, current->scratch)); + WT_RET(__wt_item_process( + session, rip->key, current->scratch)); current->dbt = ¤t->scratch->item; } else current->dbt = (WT_ITEM *)rip; @@ -353,7 +357,8 @@ err: if (_a.scratch != NULL) * Walk a WT_PAGE_COL_INT disk page and verify it. */ static int -__wt_verify_dsk_col_int(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) +__wt_verify_dsk_col_int( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { BTREE *btree; WT_OFF_RECORD *off_record; @@ -385,7 +390,8 @@ __wt_verify_dsk_col_int(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint * Walk a WT_PAGE_COL_FIX disk page and verify it. */ static int -__wt_verify_dsk_col_fix(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) +__wt_verify_dsk_col_fix( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { BTREE *btree; u_int len; @@ -425,7 +431,8 @@ delfmt: return (__wt_err_delfmt(session, entry_num, addr)); * Walk a WT_PAGE_COL_RLE disk page and verify it. */ static int -__wt_verify_dsk_col_rle(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) +__wt_verify_dsk_col_rle( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size) { BTREE *btree; u_int len; diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c index ed6269c52df..6b4a77f267c 100644 --- a/src/btree/bt_walk.c +++ b/src/btree/bt_walk.c @@ -220,7 +220,8 @@ eop: e->visited = 1; break; else if (ref->state != WT_REF_DELETED && !LF_ISSET(WT_WALK_CACHE)) { - if ((ret = __wt_page_in(session, page, ref, 0)) == 0) + ret = __wt_page_in(session, page, ref, 0); + if (ret == 0) break; /* Valid page */ else if (ret == WT_PAGE_DELETED) ret = 0; @@ -247,7 +248,8 @@ eop: e->visited = 1; break; else if (ref->state != WT_REF_DELETED && !LF_ISSET(WT_WALK_CACHE)) { - if ((ret = __wt_page_in(session, page, ref, 0)) == 0) + ret = __wt_page_in(session, page, ref, 0); + if (ret == 0) break; /* Valid page */ else if (ret == WT_PAGE_DELETED) ret = 0; diff --git a/src/btree/col_put.c b/src/btree/col_put.c index 55d2d2fab78..e44902d364e 100644 --- a/src/btree/col_put.c +++ b/src/btree/col_put.c @@ -42,7 +42,8 @@ __wt_btree_col_put(SESSION *session, uint64_t recno, WT_ITEM *data) * Column-store delete and update. */ static int -__wt_col_update(SESSION *session, uint64_t recno, WT_ITEM *data, int data_overwrite) +__wt_col_update( + SESSION *session, uint64_t recno, WT_ITEM *data, int data_overwrite) { BTREE *btree; WT_PAGE *page; @@ -88,8 +89,8 @@ __wt_col_update(SESSION *session, uint64_t recno, WT_ITEM *data, int data_overwr case WT_PAGE_COL_VAR: /* Allocate an update array if necessary. */ if (page->u.col_leaf.upd == NULL) - WT_ERR( - __wt_calloc_def(session, page->indx_count, &new_upd)); + WT_ERR(__wt_calloc_def(session, + page->indx_count, &new_upd)); /* Allocate a WT_UPDATE structure and fill it in. */ WT_ERR(__wt_update_alloc(session, &upd, data)); @@ -105,7 +106,8 @@ __wt_col_update(SESSION *session, uint64_t recno, WT_ITEM *data, int data_overwr /* workQ: schedule insert of the WT_UPDATE structure. */ __wt_rle_expand_update_serial(session, page, - session->srch_write_gen, session->srch_exp, upd, ret); + session->srch_write_gen, session->srch_exp, + upd, ret); break; } /* #3 */ @@ -124,7 +126,8 @@ __wt_col_update(SESSION *session, uint64_t recno, WT_ITEM *data, int data_overwr /* Schedule the workQ to link in the WT_RLE_EXPAND structure. */ __wt_rle_expand_serial(session, page, session->srch_write_gen, - WT_COL_INDX_SLOT(page, session->srch_ip), new_rleexp, exp, ret); + WT_COL_INDX_SLOT(page, session->srch_ip), + new_rleexp, exp, ret); break; WT_ILLEGAL_FORMAT_ERR(btree, ret); } @@ -143,7 +146,8 @@ err: if (exp != NULL) /* Free any update array unless the workQ used it. */ if (new_upd != NULL && new_upd != page->u.col_leaf.upd) - __wt_free(session, new_upd, page->indx_count * sizeof(WT_UPDATE *)); + __wt_free( + session, new_upd, page->indx_count * sizeof(WT_UPDATE *)); WT_PAGE_OUT(session, page); diff --git a/src/btree/row_put.c b/src/btree/row_put.c index 423546e5d33..f2fad5f8de5 100644 --- a/src/btree/row_put.c +++ b/src/btree/row_put.c @@ -66,7 +66,8 @@ err: if (upd != NULL) /* Free any update array unless the workQ used it. */ if (new_upd != NULL && new_upd != page->u.row_leaf.upd) - __wt_free(session, new_upd, page->indx_count * sizeof(WT_UPDATE *)); + __wt_free( + session, new_upd, page->indx_count * sizeof(WT_UPDATE *)); WT_PAGE_OUT(session, page); diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 81486701c22..59912bb8b74 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -62,7 +62,8 @@ __wt_row_search(SESSION *session, WT_ITEM *key, uint32_t flags) btree = session->btree; rip = NULL; - WT_DB_FCHK(btree, "__wt_row_search", flags, WT_APIMASK_BT_SEARCH_KEY_ROW); + WT_DB_FCHK(btree, + "__wt_row_search", flags, WT_APIMASK_BT_SEARCH_KEY_ROW); /* Search the tree. */ for (page = btree->root_page.page;;) { @@ -104,8 +105,8 @@ __wt_row_search(SESSION *session, WT_ITEM *key, uint32_t flags) * this hack. */ if (indx != 0) { - cmp = btree-> - btree_compare(btree, key, (WT_ITEM *)rref); + cmp = btree->btree_compare( + btree, key, (WT_ITEM *)rref); if (cmp == 0) break; if (cmp < 0) @@ -141,7 +142,8 @@ __wt_row_search(SESSION *session, WT_ITEM *key, uint32_t flags) if (__wt_key_process(rip)) WT_ERR(__wt_key_build(session, rip)); - cmp = btree->btree_compare(btree, key, (WT_ITEM *)rip); + cmp = btree->btree_compare( + btree, key, (WT_ITEM *)rip); if (cmp == 0) break; if (cmp < 0) diff --git a/src/db/db_handle.c b/src/db/db_handle.c index ff8be5bb1f1..a7269713690 100644 --- a/src/db/db_handle.c +++ b/src/db/db_handle.c @@ -55,7 +55,8 @@ __wt_btree_config(BTREE *btree) TAILQ_INIT(&btree->freeqa); /* Free queues */ TAILQ_INIT(&btree->freeqs); - __wt_lock(session, conn->mtx); /* Add to the CONNECTION's list */ + /* Add to the connection's list. */ + __wt_lock(session, conn->mtx); TAILQ_INSERT_TAIL(&conn->dbqh, btree, q); ++conn->dbqcnt; __wt_unlock(session, conn->mtx); @@ -111,7 +112,8 @@ __wt_btree_destroy(BTREE *btree) __wt_free(session, btree->stats, 0); __wt_free(session, btree->fstats, 0); - __wt_lock(session, conn->mtx); /* Delete from the CONNECTION's list */ + /* Remove from the connection's list. */ + __wt_lock(session, conn->mtx); TAILQ_REMOVE(&conn->dbqh, btree, q); --conn->dbqcnt; __wt_unlock(session, conn->mtx); diff --git a/src/db/db_open.c b/src/db/db_open.c index ffb9ce77f6b..6d51c7f13ed 100644 --- a/src/db/db_open.c +++ b/src/db/db_open.c @@ -7,8 +7,6 @@ #include "wt_internal.h" -static int __wt_btree_btree_open(BTREE *, const char *, mode_t, uint32_t); - /* * __wt_btree_open -- * Open a BTREE handle. @@ -16,37 +14,14 @@ static int __wt_btree_btree_open(BTREE *, const char *, mode_t, uint32_t); int __wt_btree_open(SESSION *session, const char *name, mode_t mode, uint32_t flags) { + CONNECTION *conn; BTREE *btree; btree = session->btree; + conn = btree->conn; WT_STAT_INCR(btree->conn->stats, FILE_OPEN); - /* Initialize the BTREE structure. */ - WT_RET(__wt_btree_btree_open(btree, name, mode, flags)); - - /* Open the underlying Btree. */ - WT_RET(__wt_bt_open(session, LF_ISSET(WT_CREATE) ? 1 : 0)); - - /* Turn on the methods that require open. */ - __wt_methods_btree_open_transition(btree); - - return (0); -} - -/* - * __wt_btree_btree_open -- - * Routine to intialize any BTREE values based on a BTREE value during open. - */ -static int -__wt_btree_btree_open(BTREE *btree, const char *name, mode_t mode, uint32_t flags) -{ - CONNECTION *conn; - SESSION *session; - - conn = btree->conn; - session = &conn->default_session; - WT_RET(__wt_strdup(session, name, &btree->name)); btree->mode = mode; @@ -69,6 +44,12 @@ __wt_btree_btree_open(BTREE *btree, const char *name, mode_t mode, uint32_t flag if (LF_ISSET(WT_RDONLY)) F_SET(btree, WT_RDONLY); + /* Open the underlying Btree. */ + WT_RET(__wt_bt_open(session, LF_ISSET(WT_CREATE) ? 1 : 0)); + + /* Turn on the methods that require open. */ + __wt_methods_btree_open_transition(btree); + return (0); } diff --git a/src/db/db_sync.c b/src/db/db_sync.c index d244f4addee..69d262fb2b2 100644 --- a/src/db/db_sync.c +++ b/src/db/db_sync.c @@ -12,7 +12,9 @@ * Flush pages to the backing file. */ int -__wt_btree_sync(SESSION *session, void (*f)(const char *, uint64_t), uint32_t flags) +__wt_btree_sync(SESSION *session, + void (*f)(const char *, uint64_t), + uint32_t flags) { WT_UNUSED(f); WT_UNUSED(flags); diff --git a/src/env/env_open.c b/src/env/env_open.c index 63ffd6acb98..dfe75cdbce5 100644 --- a/src/env/env_open.c +++ b/src/env/env_open.c @@ -27,11 +27,13 @@ __wt_connection_open(CONNECTION *conn, const char *home, mode_t mode) ret = 0; /* SESSION and hazard arrays. */ - WT_RET(__wt_calloc(session, conn->session_size, sizeof(SESSION *), &conn->sessions)); - WT_RET( - __wt_calloc(session, conn->session_size, sizeof(SESSION), &conn->toc_array)); WT_RET(__wt_calloc(session, - conn->session_size * conn->hazard_size, sizeof(WT_PAGE *), &conn->hazard)); + conn->session_size, sizeof(SESSION *), &conn->sessions)); + WT_RET(__wt_calloc(session, + conn->session_size, sizeof(SESSION), &conn->toc_array)); + WT_RET(__wt_calloc(session, + conn->session_size * conn->hazard_size, sizeof(WT_PAGE *), + &conn->hazard)); /* Create the cache. */ WT_RET(__wt_cache_create(conn)); diff --git a/src/env/env_session.c b/src/env/env_session.c index 273ffc8e874..492e35a8b5a 100644 --- a/src/env/env_session.c +++ b/src/env/env_session.c @@ -31,7 +31,9 @@ __wt_connection_session(CONNECTION *conn, SESSION **sessionp) * The SESSION reference list is compact, the SESSION array is not. * Find the first empty SESSION slot. */ - for (slot = 0, session = conn->toc_array; session->iface.connection != NULL; ++session, ++slot) + for (slot = 0, session = conn->toc_array; + session->iface.connection != NULL; + ++session, ++slot) ; /* Clear previous contents of the SESSION entry, they get re-used. */ @@ -40,7 +42,9 @@ __wt_connection_session(CONNECTION *conn, SESSION **sessionp) session->iface.connection = &conn->iface; session->hazard = conn->hazard + slot * conn->hazard_size; - WT_RET(__wt_mtx_alloc(&conn->default_session, "session", 1, &session->mtx)); + /* We can't use the new session: it hasn't been configured yet. */ + WT_RET(__wt_mtx_alloc( + &conn->default_session, "session", 1, &session->mtx)); __wt_methods_session_lockout(session); __wt_methods_session_init_transition(session); @@ -127,7 +131,8 @@ __wt_session_close(SESSION *session) * Pair SESSION and BTREE handle, allocating the SESSION as necessary. */ int -__wt_session_api_set(CONNECTION *conn, const char *name, BTREE *btree, SESSION **sessionp) +__wt_session_api_set( + CONNECTION *conn, const char *name, BTREE *btree, SESSION **sessionp) { SESSION *session; @@ -192,7 +197,8 @@ __wt_session_dump(CONNECTION *conn) else __wt_mb_add(&mb, "%p", session->wq_func); - __wt_mb_add(&mb, " state: %s", __wt_session_print_state(session)); + __wt_mb_add(&mb, + " state: %s", __wt_session_print_state(session)); __wt_mb_add(&mb, "\n\thazard: "); for (hp = session->hazard; diff --git a/src/include/api.h b/src/include/api.h index cdb2de85476..bcd1ced8f5c 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -292,7 +292,7 @@ struct __connection { pthread_t cache_evict_tid; /* Cache eviction server thread ID */ pthread_t cache_read_tid; /* Cache read server thread ID */ - TAILQ_HEAD(__wt_btree_qh, __btree) dbqh; /* Locked: database list */ + TAILQ_HEAD(__wt_btree_qh, __btree) dbqh; /* Locked: database list */ u_int dbqcnt; /* Locked: database list count */ TAILQ_HEAD( diff --git a/src/include/btree.h b/src/include/btree.h index fd583d7c72f..ce6873a8bc4 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -441,9 +441,8 @@ struct __wt_page { /* * WT_ROW -- * Each in-memory page row-store leaf page has an array of WT_ROW structures: - * this is where the on-page index in Berkeley BTREE is created when a page is read - * from the file. It's sorted by key, fixed in size, and references data on the - * page. + * this is created from on-page data when a page is read from the file. + * It's sorted by key, fixed in size, and references data on the page. */ struct __wt_row { /* @@ -486,9 +485,9 @@ struct __wt_row { /* * WT_COL -- - * Each in-memory column-store leaf page has an array of WT_COL structures: this - * is where the on-page index in Berkeley BTREE is created when a page is read from - * the file. It's fixed in size, and references data on the page. + * Each in-memory column-store leaf page has an array of WT_COL structures: + * this is created from on-page data when a page is read from the file. + * It's fixed in size, and references data on the page. * * In column-store fixed-length run-length encoded pages (WT_PAGE_COL_RLE type * pages), a single indx entry may reference a large number of records, because @@ -582,8 +581,9 @@ struct __wt_update { * handle this by "inserting" a new entry into the rleexp array. This is the * only case where it's possible to "insert" into a column-store, it's normally * only possible to append to a column-store as insert requires re-numbering - * subsequent records. (Berkeley BTREE did support the re-numbering functionality, - * but it won't scale and it isn't useful enough to re-implement, IMNSHO.) + * subsequent records. (Berkeley DB did support the re-numbering + * functionality, but it won't scale and it isn't useful enough to + * re-implement, IMNSHO.) */ struct __wt_rle_expand { uint64_t recno; /* recno */ diff --git a/src/include/extern.h b/src/include/extern.h index f7a2a47a24a..ddbd9855d46 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -46,7 +46,8 @@ void __wt_debug_block(SESSION *session); int __wt_btree_bulk_load(SESSION *session, - void (*f)(const char *, uint64_t), int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)); + void (*f)(const char *, uint64_t), + int (*cb)(BTREE *, WT_ITEM **, WT_ITEM **)); int __wt_bulk_init(ICURSOR_BULK *cbulk); int @@ -65,13 +66,16 @@ __wt_cache_destroy(CONNECTION *conn); int __wt_bt_close(SESSION *session); int -__wt_bt_lex_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_dbt); +__wt_bt_lex_compare( + BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item); int -__wt_bt_int_compare(BTREE *btree, const WT_ITEM *user_dbt, const WT_ITEM *tree_dbt); +__wt_bt_int_compare( + BTREE *btree, const WT_ITEM *user_item, const WT_ITEM *tree_item); int __wt_debug_dump(SESSION *session, const char *ofile, FILE *fp); int -__wt_debug_disk(SESSION *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp); +__wt_debug_disk( + SESSION *session, WT_PAGE_DISK *dsk, const char *ofile, FILE *fp); int __wt_debug_page(SESSION *session, WT_PAGE *page, const char *ofile, FILE *fp); void @@ -135,9 +139,11 @@ __wt_rle_expand_sort(SESSION *session, int __wt_data_return(SESSION *session, WT_ITEM *key, WT_ITEM *value, int key_return); int -__wt_disk_read(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); +__wt_disk_read( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); int -__wt_disk_write(SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); +__wt_disk_write( + SESSION *session, WT_PAGE_DISK *dsk, uint32_t addr, uint32_t size); int __wt_page_stat(SESSION *session, WT_PAGE *page, void *arg); int @@ -213,7 +219,9 @@ __wt_btree_stat_print(SESSION *session, FILE *stream); int __wt_btree_stat_clear(BTREE *btree); int -__wt_btree_sync(SESSION *session, void (*f)(const char *, uint64_t), uint32_t flags); +__wt_btree_sync(SESSION *session, + void (*f)(const char *, uint64_t), + uint32_t flags); int __wt_connection_cache_size_set_verify(CONNECTION *conn, uint32_t cache_size); int @@ -253,7 +261,8 @@ __wt_connection_session(CONNECTION *conn, SESSION **sessionp); int __wt_session_close(SESSION *session); int -__wt_session_api_set(CONNECTION *conn, const char *name, BTREE *btree, SESSION **sessionp); +__wt_session_api_set( + CONNECTION *conn, const char *name, BTREE *btree, SESSION **sessionp); int __wt_session_api_clr(SESSION *session, const char *name, int islocal); int @@ -316,7 +325,8 @@ __wt_unlock(SESSION *session, WT_MTX *mtx); int __wt_mtx_destroy(SESSION *session, WT_MTX *mtx); int -__wt_open(SESSION *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp); +__wt_open( + SESSION *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp); int __wt_close(SESSION *session, WT_FH *fh); int @@ -341,7 +351,8 @@ void __wt_msg_stream(FILE *fp, const char *pfx1, const char *pfx2, int error, const char *fmt, va_list ap); void -__wt_assert(SESSION *session, const char *check, const char *file_name, int line_number); +__wt_assert( + SESSION *session, const char *check, const char *file_name, int line_number); int __wt_api_args(SESSION *session, const char *name); int @@ -367,7 +378,9 @@ __wt_btree_lockout(BTREE *btree); int __wt_connection_lockout(CONNECTION *conn); int -__wt_errv(SESSION *session, int error, const char *prefix, const char *fmt, va_list ap); +__wt_errv( + SESSION *session, int error, + const char *prefix, const char *fmt, va_list ap); int __wt_err(SESSION *session, int error, const char *fmt, ...); int @@ -412,8 +425,8 @@ __wt_scr_release(WT_BUF **bufp); void __wt_scr_free(SESSION *session); int -__wt_session_serialize_func( - SESSION *session, wq_state_t op, int spin, int (*func)(SESSION *), void *args); +__wt_session_serialize_func(SESSION *session, + wq_state_t op, int spin, int (*func)(SESSION *), void *args); void __wt_session_serialize_wrapup(SESSION *session, WT_PAGE *page, int ret); int diff --git a/src/include/queue.h b/src/include/queue.h index 651b66fce53..d76f2019f6f 100644 --- a/src/include/queue.h +++ b/src/include/queue.h @@ -110,7 +110,7 @@ extern "C" { * We #undef all of the macros because there are incompatible versions of this * file and these macros on various systems. What makes the problem worse is * they are included and/or defined by system include files which we may have - * already loaded into Berkeley BTREE before getting here. For example, FreeBSD's + * already loaded into Berkeley DB before getting here. For example, FreeBSD's * <rpc/rpc.h> includes its system <sys/queue.h>, and VxWorks UnixLib.h defines * several of the LIST_XXX macros. Visual C.NET 7.0 also defines some of these * same macros in Vc7\PlatformSDK\Include\WinNT.h. Make sure we use ours. diff --git a/src/include/serial.h b/src/include/serial.h index 6c1444a3d08..c409d0b9175 100644 --- a/src/include/serial.h +++ b/src/include/serial.h @@ -16,9 +16,11 @@ typedef struct { } while (0) #define __wt_cache_read_unpack(\ session, _parent, _parent_ref, _dsk_verify) do {\ - _parent = ((__wt_cache_read_args *)(session)->wq_args)->parent;\ - _parent_ref = ((__wt_cache_read_args *)(session)->wq_args)->parent_ref;\ - _dsk_verify = ((__wt_cache_read_args *)(session)->wq_args)->dsk_verify;\ + __wt_cache_read_args *_args =\ + (__wt_cache_read_args *)(session)->wq_args;\ + _parent = _args->parent;\ + _parent_ref = _args->parent_ref;\ + _dsk_verify = _args->dsk_verify;\ } while (0) typedef struct { @@ -41,11 +43,13 @@ typedef struct { } while (0) #define __wt_item_update_unpack(\ session, _page, _write_gen, _slot, _new_upd, _upd) do {\ - _page = ((__wt_item_update_args *)(session)->wq_args)->page;\ - _write_gen = ((__wt_item_update_args *)(session)->wq_args)->write_gen;\ - _slot = ((__wt_item_update_args *)(session)->wq_args)->slot;\ - _new_upd = ((__wt_item_update_args *)(session)->wq_args)->new_upd;\ - _upd = ((__wt_item_update_args *)(session)->wq_args)->upd;\ + __wt_item_update_args *_args =\ + (__wt_item_update_args *)(session)->wq_args;\ + _page = _args->page;\ + _write_gen = _args->write_gen;\ + _slot = _args->slot;\ + _new_upd = _args->new_upd;\ + _upd = _args->upd;\ } while (0) typedef struct { @@ -68,11 +72,13 @@ typedef struct { } while (0) #define __wt_rle_expand_unpack(\ session, _page, _write_gen, _slot, _new_rleexp, _exp) do {\ - _page = ((__wt_rle_expand_args *)(session)->wq_args)->page;\ - _write_gen = ((__wt_rle_expand_args *)(session)->wq_args)->write_gen;\ - _slot = ((__wt_rle_expand_args *)(session)->wq_args)->slot;\ - _new_rleexp = ((__wt_rle_expand_args *)(session)->wq_args)->new_rleexp;\ - _exp = ((__wt_rle_expand_args *)(session)->wq_args)->exp;\ + __wt_rle_expand_args *_args =\ + (__wt_rle_expand_args *)(session)->wq_args;\ + _page = _args->page;\ + _write_gen = _args->write_gen;\ + _slot = _args->slot;\ + _new_rleexp = _args->new_rleexp;\ + _exp = _args->exp;\ } while (0) typedef struct { @@ -93,8 +99,10 @@ typedef struct { } while (0) #define __wt_rle_expand_update_unpack(\ session, _page, _write_gen, _exp, _upd) do {\ - _page = ((__wt_rle_expand_update_args *)(session)->wq_args)->page;\ - _write_gen = ((__wt_rle_expand_update_args *)(session)->wq_args)->write_gen;\ - _exp = ((__wt_rle_expand_update_args *)(session)->wq_args)->exp;\ - _upd = ((__wt_rle_expand_update_args *)(session)->wq_args)->upd;\ + __wt_rle_expand_update_args *_args =\ + (__wt_rle_expand_update_args *)(session)->wq_args;\ + _page = _args->page;\ + _write_gen = _args->write_gen;\ + _exp = _args->exp;\ + _upd = _args->upd;\ } while (0) diff --git a/src/os_posix/os_alloc.c b/src/os_posix/os_alloc.c index 9772f5f869c..e956c049a99 100644 --- a/src/os_posix/os_alloc.c +++ b/src/os_posix/os_alloc.c @@ -289,7 +289,8 @@ __wt_mtrack_free(CONNECTION *conn) * Track memory allocations and frees. */ static void -__wt_mtrack(SESSION *session, const void *f, const void *a, const char *file, int line) +__wt_mtrack( + SESSION *session, const void *f, const void *a, const char *file, int line) { WT_MEM *mp, *t, *mp_end; WT_MTRACK *mtrack; diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c index 41f22b17bff..22de5cf854e 100644 --- a/src/os_posix/os_open.c +++ b/src/os_posix/os_open.c @@ -12,7 +12,8 @@ * Open a file handle. */ int -__wt_open(SESSION *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp) +__wt_open( + SESSION *session, const char *name, mode_t mode, int ok_create, WT_FH **fhp) { BTREE *btree; CONNECTION *conn; diff --git a/src/support/err.c b/src/support/err.c index 02d734ed895..d0f53bc6262 100644 --- a/src/support/err.c +++ b/src/support/err.c @@ -77,7 +77,8 @@ __wt_msg_stream(FILE *fp, * Internal version of assert function. */ void -__wt_assert(SESSION *session, const char *check, const char *file_name, int line_number) +__wt_assert( + SESSION *session, const char *check, const char *file_name, int line_number) { __wt_errx(session, "assertion failure: %s/%d: \"%s\"", file_name, line_number, check); @@ -259,7 +260,9 @@ __wt_connection_lockout(CONNECTION *conn) } int -__wt_errv(SESSION *session, int error, const char *prefix, const char *fmt, va_list ap) +__wt_errv( + SESSION *session, int error, + const char *prefix, const char *fmt, va_list ap) { WT_ERROR_HANDLER *handler; char *end, *p; diff --git a/src/support/hazard.c b/src/support/hazard.c index a3afc82f2a3..7897da851af 100644 --- a/src/support/hazard.c +++ b/src/support/hazard.c @@ -33,7 +33,9 @@ __wt_hazard_set(SESSION *session, WT_REF *ref) * server sets the WT_REF state to WT_REF_EVICT, flushes memory, and * then checks the hazard references). */ - for (hp = session->hazard; hp < session->hazard + conn->hazard_size; ++hp) { + for (hp = session->hazard; + hp < session->hazard + conn->hazard_size; + ++hp) { if (*hp != NULL) continue; @@ -52,8 +54,8 @@ __wt_hazard_set(SESSION *session, WT_REF *ref) if (ref->state == WT_REF_CACHE || (ref->state == WT_REF_EVICT && F_ISSET(session, WT_READ_EVICT))) { - WT_VERBOSE(conn, WT_VERB_HAZARD, - (session, "session %p hazard %p: set", session, ref->page)); + WT_VERBOSE(conn, WT_VERB_HAZARD, (session, + "session %p hazard %p: set", session, ref->page)); return (1); } @@ -79,11 +81,13 @@ __wt_hazard_clear(SESSION *session, WT_PAGE *page) conn = S2C(session); - WT_VERBOSE(conn, - WT_VERB_HAZARD, (session, "session %p hazard %p: clr", session, page)); + WT_VERBOSE(conn, WT_VERB_HAZARD, (session, + "session %p hazard %p: clr", session, page)); /* Clear the caller's hazard pointer. */ - for (hp = session->hazard; hp < session->hazard + conn->hazard_size; ++hp) + for (hp = session->hazard; + hp < session->hazard + conn->hazard_size; + ++hp) if (*hp == page) { *hp = NULL; /* @@ -121,7 +125,9 @@ __wt_hazard_empty(SESSION *session, const char *name) * cache eviction thread immediate access to any page our reference * blocks. */ - for (hp = session->hazard; hp < session->hazard + conn->hazard_size; ++hp) + for (hp = session->hazard; + hp < session->hazard + conn->hazard_size; + ++hp) if (*hp != NULL) { __wt_errx(session, "%s: returned with a hazard reference set (%p)", diff --git a/src/support/huffman.c b/src/support/huffman.c index 73372c6b485..3e236b72751 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -220,7 +220,8 @@ __wt_huffman_open(SESSION *session, ret = 0; WT_RET(__wt_calloc(session, 1, sizeof(WT_HUFFMAN_OBJ), &huffman)); - WT_ERR(__wt_calloc(session, nbytes, sizeof(INDEXED_BYTE), &indexed_freqs)); + WT_ERR(__wt_calloc( + session, nbytes, sizeof(INDEXED_BYTE), &indexed_freqs)); huffman->session = session; /* @@ -301,8 +302,8 @@ __wt_huffman_open(SESSION *session, tempnode->right = node2; /* Enqueue it to the combined nodes queue */ - WT_ERR( - node_queue_enqueue(session, combined_nodes, tempnode)); + WT_ERR(node_queue_enqueue( + session, combined_nodes, tempnode)); tempnode = NULL; /* Reset the state pointers */ diff --git a/src/support/prime.c b/src/support/prime.c index f7314f20daa..4a0b8109abd 100644 --- a/src/support/prime.c +++ b/src/support/prime.c @@ -17,7 +17,7 @@ __wt_prime(uint32_t n) /* * Ref: the hash functions section of "Algorithms in C", by Sedgewick. * - * The table is the same as the one in Berkeley BTREE -- check at each + * The table is the same as the one in Berkeley DB -- check at each * power-of-two up to 2^18, then mid-points between each power-of-two * to a maximum of 2^30. */ diff --git a/src/support/scratch.c b/src/support/scratch.c index b5a742dedec..881a1d197d0 100644 --- a/src/support/scratch.c +++ b/src/support/scratch.c @@ -122,5 +122,6 @@ __wt_scr_free(SESSION *session) ++i, ++buf) __wt_buf_free(session, buf); - __wt_free(session, session->scratch, session->scratch_alloc * sizeof(WT_BUF)); + __wt_free( + session, session->scratch, session->scratch_alloc * sizeof(WT_BUF)); } diff --git a/src/support/serial.c b/src/support/serial.c index 488ac00975d..31b14c3da81 100644 --- a/src/support/serial.c +++ b/src/support/serial.c @@ -32,8 +32,8 @@ * Schedule a serialization request, and block or spin until it completes. */ int -__wt_session_serialize_func( - SESSION *session, wq_state_t op, int spin, int (*func)(SESSION *), void *args) +__wt_session_serialize_func(SESSION *session, + wq_state_t op, int spin, int (*func)(SESSION *), void *args) { int done; diff --git a/src/utilities/util_load.c b/src/utilities/util_load.c index 1749ee9cd38..7a93905da81 100644 --- a/src/utilities/util_load.c +++ b/src/utilities/util_load.c @@ -88,7 +88,7 @@ main(int argc, char *argv[]) /* * Right now, we only support text input -- require the T option to - * match Berkeley BTREE's API. + * match Berkeley DB's API. */ if (text_input == 0) { fprintf(stderr, |