diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-08-13 10:03:51 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-08-13 10:03:51 -0400 |
commit | 05721dd96dda0b6658e2c7484dc0f81e7b7847a3 (patch) | |
tree | 1269ae9c18a954e744e12d285a9fcc1957865a06 | |
parent | 16d005872cc930d6e740408997eebdeb93c05179 (diff) | |
parent | 46c53331d00289f633fd8856bb52509c96dc2b93 (diff) | |
download | mongo-05721dd96dda0b6658e2c7484dc0f81e7b7847a3.tar.gz |
Merge branch 'develop' into wt-2025-inline-atomic-functions
30 files changed, 143 insertions, 143 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c index 721b41432cb..6b0ce47ef3f 100644 --- a/bench/wtperf/config.c +++ b/bench/wtperf/config.c @@ -96,7 +96,7 @@ config_assign(CONFIG *dest, const CONFIG *src) } } - STAILQ_INIT(&dest->stone_head); + TAILQ_INIT(&dest->stone_head); return (0); } diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h index 58dc65388ae..e4b9fc00798 100644 --- a/bench/wtperf/wtperf.h +++ b/bench/wtperf/wtperf.h @@ -122,7 +122,7 @@ struct __truncate_struct { struct __truncate_queue_entry { char *key; /* Truncation point */ uint64_t diff; /* Number of items to be truncated*/ - STAILQ_ENTRY(__truncate_queue_entry) q; + TAILQ_ENTRY(__truncate_queue_entry) q; }; typedef struct __truncate_queue_entry TRUNCATE_QUEUE_ENTRY; @@ -178,7 +178,7 @@ struct __config { /* Configuration structure */ u_int has_truncate; /* if there is a truncate workload */ /* Queue head for use with the Truncate Logic */ - STAILQ_HEAD(__truncate_qh, __truncate_queue_entry) stone_head; + TAILQ_HEAD(__truncate_qh, __truncate_queue_entry) stone_head; /* Fields changeable on command line are listed in wtperf_opt.i */ #define OPT_DECLARE_STRUCT diff --git a/bench/wtperf/wtperf_truncate.c b/bench/wtperf/wtperf_truncate.c index 0d5d1045e1e..581d1987947 100644 --- a/bench/wtperf/wtperf_truncate.c +++ b/bench/wtperf/wtperf_truncate.c @@ -112,7 +112,7 @@ setup_truncate(CONFIG *cfg, CONFIG_THREAD *thread, WT_SESSION *session) { truncate_item->key = truncate_key; truncate_item->diff = (trunc_cfg->stone_gap * i) - trunc_cfg->last_key; - STAILQ_INSERT_TAIL( &cfg->stone_head, truncate_item, q); + TAILQ_INSERT_TAIL( &cfg->stone_head, truncate_item, q); trunc_cfg->last_key = trunc_cfg->stone_gap * i; trunc_cfg->num_stones++; } @@ -166,7 +166,7 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, generate_key(cfg, truncate_key, trunc_cfg->last_key); truncate_item->key = truncate_key; truncate_item->diff = trunc_cfg->stone_gap; - STAILQ_INSERT_TAIL(&cfg->stone_head, truncate_item, q); + TAILQ_INSERT_TAIL(&cfg->stone_head, truncate_item, q); trunc_cfg->num_stones++; } @@ -175,9 +175,9 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, trunc_cfg->expected_total <= thread->workload->truncate_count) return (0); - truncate_item = STAILQ_FIRST(&cfg->stone_head); + truncate_item = TAILQ_FIRST(&cfg->stone_head); trunc_cfg->num_stones--; - STAILQ_REMOVE_HEAD(&cfg->stone_head, q); + TAILQ_REMOVE(&cfg->stone_head, truncate_item, q); cursor->set_key(cursor,truncate_item->key); if ((ret = cursor->search(cursor)) != 0) { lprintf(cfg, ret, 0, "Truncate search: failed"); @@ -207,9 +207,9 @@ void cleanup_truncate_config(CONFIG *cfg) { TRUNCATE_QUEUE_ENTRY *truncate_item; - while (!STAILQ_EMPTY(&cfg->stone_head)) { - truncate_item = STAILQ_FIRST(&cfg->stone_head); - STAILQ_REMOVE_HEAD(&cfg->stone_head, q); + while (!TAILQ_EMPTY(&cfg->stone_head)) { + truncate_item = TAILQ_FIRST(&cfg->stone_head); + TAILQ_REMOVE(&cfg->stone_head, truncate_item, q); free(truncate_item->key); free(truncate_item); } diff --git a/dist/s_style b/dist/s_style index e5411748a31..2237b520020 100755 --- a/dist/s_style +++ b/dist/s_style @@ -46,6 +46,11 @@ else cat $t fi + if ! expr "$f" : 'src/include/queue\.h' > /dev/null && + egrep 'STAILQ_|SLIST_|\bLIST_' $f ; then + echo "$f: use TAILQ for all lists" + fi + if ! expr "$f" : 'src/os_posix/.*' > /dev/null && ! expr "$f" : 'src/os_win/.*' > /dev/null && ! expr "$f" : 'src/include/extern.h' > /dev/null && diff --git a/src/async/async_api.c b/src/async/async_api.c index 2b4dd843d54..7d0ae1bfd5d 100644 --- a/src/async/async_api.c +++ b/src/async/async_api.c @@ -43,7 +43,7 @@ __async_get_format(WT_CONNECTION_IMPL *conn, const char *uri, * is a possibility a duplicate entry might be inserted, but * that is not harmful. */ - STAILQ_FOREACH(af, &async->formatqh, q) { + TAILQ_FOREACH(af, &async->formatqh, q) { if (af->uri_hash == uri_hash && af->cfg_hash == cfg_hash) goto setup; } @@ -71,7 +71,7 @@ __async_get_format(WT_CONNECTION_IMPL *conn, const char *uri, WT_ERR(c->close(c)); c = NULL; - STAILQ_INSERT_HEAD(&async->formatqh, af, q); + TAILQ_INSERT_HEAD(&async->formatqh, af, q); __wt_spin_unlock(session, &async->ops_lock); WT_ERR(wt_session->close(wt_session, NULL)); @@ -237,7 +237,7 @@ __async_start(WT_SESSION_IMPL *session) */ WT_RET(__wt_calloc_one(session, &conn->async)); async = conn->async; - STAILQ_INIT(&async->formatqh); + TAILQ_INIT(&async->formatqh); WT_RET(__wt_spin_init(session, &async->ops_lock, "ops")); WT_RET(__wt_cond_alloc(session, "async flush", 0, &async->flush_cond)); WT_RET(__wt_async_op_init(session)); @@ -461,9 +461,9 @@ __wt_async_destroy(WT_SESSION_IMPL *session) } /* Free format resources */ - af = STAILQ_FIRST(&async->formatqh); + af = TAILQ_FIRST(&async->formatqh); while (af != NULL) { - afnext = STAILQ_NEXT(af, q); + afnext = TAILQ_NEXT(af, q); __wt_free(session, af->uri); __wt_free(session, af->config); __wt_free(session, af->key_format); diff --git a/src/async/async_worker.c b/src/async/async_worker.c index b876421cc37..0bab800608b 100644 --- a/src/async/async_worker.c +++ b/src/async/async_worker.c @@ -135,7 +135,7 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op, if (op->optype == WT_AOP_COMPACT) return (0); WT_ASSERT(session, op->format != NULL); - STAILQ_FOREACH(ac, &worker->cursorqh, q) { + TAILQ_FOREACH(ac, &worker->cursorqh, q) { if (op->format->cfg_hash == ac->cfg_hash && op->format->uri_hash == ac->uri_hash) { /* @@ -156,7 +156,7 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op, ac->cfg_hash = op->format->cfg_hash; ac->uri_hash = op->format->uri_hash; ac->c = c; - STAILQ_INSERT_HEAD(&worker->cursorqh, ac, q); + TAILQ_INSERT_HEAD(&worker->cursorqh, ac, q); worker->num_cursors++; *cursorp = c; return (0); @@ -297,7 +297,7 @@ __wt_async_worker(void *arg) async = conn->async; worker.num_cursors = 0; - STAILQ_INIT(&worker.cursorqh); + TAILQ_INIT(&worker.cursorqh); while (F_ISSET(conn, WT_CONN_SERVER_ASYNC) && F_ISSET(session, WT_SESSION_SERVER_ASYNC)) { WT_ERR(__async_op_dequeue(conn, session, &op)); @@ -346,9 +346,9 @@ err: WT_PANIC_MSG(session, ret, "async worker error"); * Worker thread cleanup, close our cached cursors and free all the * WT_ASYNC_CURSOR structures. */ - ac = STAILQ_FIRST(&worker.cursorqh); + ac = TAILQ_FIRST(&worker.cursorqh); while (ac != NULL) { - acnext = STAILQ_NEXT(ac, q); + acnext = TAILQ_NEXT(ac, q); WT_TRET(ac->c->close(ac->c)); __wt_free(session, ac); ac = acnext; diff --git a/src/block/block_open.c b/src/block/block_open.c index 1fb4ecd03a7..c4884e8dafc 100644 --- a/src/block/block_open.c +++ b/src/block/block_open.c @@ -185,7 +185,7 @@ __wt_block_open(WT_SESSION_IMPL *session, hash = __wt_hash_city64(filename, strlen(filename)); bucket = hash % WT_HASH_ARRAY_SIZE; __wt_spin_lock(session, &conn->block_lock); - SLIST_FOREACH(block, &conn->blockhash[bucket], hashl) { + TAILQ_FOREACH(block, &conn->blockhash[bucket], hashq) { if (strcmp(filename, block->name) == 0) { ++block->ref; *blockp = block; diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index bc96ddd117a..62114ec8b5a 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -432,7 +432,7 @@ __wt_encryptor_config(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cval, "requires connection encryption to be set"); hash = __wt_hash_city64(keyid->str, keyid->len); bucket = hash % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(kenc, &nenc->keyedhashlh[bucket], l) + TAILQ_FOREACH(kenc, &nenc->keyedhashqh[bucket], q) if (WT_STRING_MATCH(kenc->keyid, keyid->str, keyid->len)) goto out; @@ -450,8 +450,8 @@ __wt_encryptor_config(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cval, WT_ERR(encryptor->sizing(encryptor, &session->iface, &kenc->size_const)); kenc->encryptor = encryptor; - SLIST_INSERT_HEAD(&nenc->keyedlh, kenc, l); - SLIST_INSERT_HEAD(&nenc->keyedhashlh[bucket], kenc, hashl); + TAILQ_INSERT_HEAD(&nenc->keyedqh, kenc, q); + TAILQ_INSERT_HEAD(&nenc->keyedhashqh[bucket], kenc, hashq); out: __wt_spin_unlock(session, &conn->encryptor_lock); *kencryptorp = kenc; @@ -506,9 +506,9 @@ __conn_add_encryptor(WT_CONNECTION *wt_conn, WT_ERR(__wt_calloc_one(session, &nenc)); WT_ERR(__wt_strdup(session, name, &nenc->name)); nenc->encryptor = encryptor; - SLIST_INIT(&nenc->keyedlh); + TAILQ_INIT(&nenc->keyedqh); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) - SLIST_INIT(&nenc->keyedhashlh[i]); + TAILQ_INIT(&nenc->keyedhashqh[i]); TAILQ_INSERT_TAIL(&conn->encryptqh, nenc, q); nenc = NULL; @@ -537,15 +537,14 @@ __wt_conn_remove_encryptor(WT_SESSION_IMPL *session) conn = S2C(session); while ((nenc = TAILQ_FIRST(&conn->encryptqh)) != NULL) { - while ((kenc = SLIST_FIRST(&nenc->keyedlh)) != NULL) { + while ((kenc = TAILQ_FIRST(&nenc->keyedqh)) != NULL) { /* Call any termination method. */ if (kenc->owned && kenc->encryptor->terminate != NULL) WT_TRET(kenc->encryptor->terminate( kenc->encryptor, (WT_SESSION *)session)); /* Remove from the connection's list, free memory. */ - SLIST_REMOVE( - &nenc->keyedlh, kenc, __wt_keyed_encryptor, l); + TAILQ_REMOVE(&nenc->keyedqh, kenc, q); __wt_free(session, kenc->keyid); __wt_free(session, kenc); } diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index 1ea609f6578..f1e67e2882b 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -81,7 +81,7 @@ __wt_conn_dhandle_find( bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; if (checkpoint == NULL) { - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; if (dhandle->checkpoint == NULL && @@ -91,7 +91,7 @@ __wt_conn_dhandle_find( } } } else - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; if (dhandle->checkpoint != NULL && @@ -399,7 +399,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session, if (uri != NULL) { bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && strcmp(uri, dhandle->name) == 0 && @@ -407,7 +407,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session, WT_RET(__conn_btree_apply_internal( session, dhandle, func, cfg)); } else { - SLIST_FOREACH(dhandle, &conn->dhlh, l) + TAILQ_FOREACH(dhandle, &conn->dhqh, q) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && (apply_checkpoints || @@ -484,7 +484,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session, hash = __wt_hash_city64(uri, strlen(uri)); bucket = hash % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && (hash == dhandle->name_hash && @@ -533,7 +533,7 @@ __wt_conn_dhandle_close_all( WT_ASSERT(session, session->dhandle == NULL); bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (strcmp(dhandle->name, uri) != 0 || F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; @@ -671,7 +671,7 @@ __wt_conn_dhandle_discard(WT_SESSION_IMPL *session) * the list, so we do it the hard way. */ restart: - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (WT_IS_METADATA(dhandle)) continue; @@ -690,7 +690,7 @@ restart: F_SET(session, WT_SESSION_NO_DATA_HANDLES); /* Close the metadata file handle. */ - while ((dhandle = SLIST_FIRST(&conn->dhlh)) != NULL) + while ((dhandle = TAILQ_FIRST(&conn->dhqh)) != NULL) WT_WITH_DHANDLE(session, dhandle, WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0))); diff --git a/src/conn/conn_handle.c b/src/conn/conn_handle.c index 94e69897c1d..c02f145a09a 100644 --- a/src/conn/conn_handle.c +++ b/src/conn/conn_handle.c @@ -21,14 +21,14 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn) session = conn->default_session; for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) { - SLIST_INIT(&conn->dhhash[i]); /* Data handle hash lists */ - SLIST_INIT(&conn->fhhash[i]); /* File handle hash lists */ + TAILQ_INIT(&conn->dhhash[i]); /* Data handle hash lists */ + TAILQ_INIT(&conn->fhhash[i]); /* File handle hash lists */ } - SLIST_INIT(&conn->dhlh); /* Data handle list */ + TAILQ_INIT(&conn->dhqh); /* Data handle list */ TAILQ_INIT(&conn->dlhqh); /* Library list */ TAILQ_INIT(&conn->dsrcqh); /* Data source list */ - SLIST_INIT(&conn->fhlh); /* File list */ + TAILQ_INIT(&conn->fhqh); /* File list */ TAILQ_INIT(&conn->collqh); /* Collator list */ TAILQ_INIT(&conn->compqh); /* Compressor list */ TAILQ_INIT(&conn->encryptqh); /* Encryptor list */ @@ -91,8 +91,8 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn) */ WT_RET(__wt_spin_init(session, &conn->block_lock, "block manager")); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) - SLIST_INIT(&conn->blockhash[i]);/* Block handle hash lists */ - SLIST_INIT(&conn->blocklh); /* Block manager list */ + TAILQ_INIT(&conn->blockhash[i]);/* Block handle hash lists */ + TAILQ_INIT(&conn->blockqh); /* Block manager list */ return (0); } diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c index 3f3808579a9..51e42cc0aa4 100644 --- a/src/conn/conn_open.c +++ b/src/conn/conn_open.c @@ -146,14 +146,14 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) * Complain if files weren't closed, ignoring the lock file, we'll * close it in a minute. */ - SLIST_FOREACH(fh, &conn->fhlh, l) { + TAILQ_FOREACH(fh, &conn->fhqh, q) { if (fh == conn->lock_fh) continue; __wt_errx(session, "Connection has open file handles: %s", fh->name); WT_TRET(__wt_close(session, &fh)); - fh = SLIST_FIRST(&conn->fhlh); + fh = TAILQ_FIRST(&conn->fhqh); } /* Disconnect from shared cache - must be before cache destroy. */ diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index fe380567b2f..487e6291f60 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -21,7 +21,7 @@ __sweep_mark(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (WT_IS_METADATA(dhandle)) continue; @@ -116,7 +116,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { /* * Ignore open files once the btree file count is below the * minimum number of handles. @@ -155,7 +155,7 @@ __sweep_discard_trees( *dead_handlesp = 0; - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (!F_ISSET(dhandle, WT_DHANDLE_OPEN | WT_DHANDLE_EXCLUSIVE) && (dhandle->timeofdiscard == 0 || now <= dhandle->timeofdiscard + conn->sweep_idle_time)) @@ -229,10 +229,10 @@ __sweep_remove_handles(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - for (dhandle = SLIST_FIRST(&conn->dhlh); + for (dhandle = TAILQ_FIRST(&conn->dhqh); dhandle != NULL; dhandle = dhandle_next) { - dhandle_next = SLIST_NEXT(dhandle, l); + dhandle_next = TAILQ_NEXT(dhandle, q); if (WT_IS_METADATA(dhandle)) continue; if (F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_OPEN) || diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 061cca0f1bc..a542cb89018 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -632,7 +632,7 @@ __evict_clear_all_walks(WT_SESSION_IMPL *session) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) + TAILQ_FOREACH(dhandle, &conn->dhqh, q) if (WT_PREFIX_MATCH(dhandle->name, "file:")) WT_WITH_DHANDLE(session, dhandle, WT_TRET(__evict_clear_walk(session))); @@ -968,7 +968,7 @@ retry: while (slot < max_entries && ret == 0) { if ((dhandle = cache->evict_file_next) != NULL) cache->evict_file_next = NULL; else - dhandle = SLIST_FIRST(&conn->dhlh); + dhandle = TAILQ_FIRST(&conn->dhqh); } else { if (incr) { WT_ASSERT(session, dhandle->session_inuse > 0); @@ -976,7 +976,7 @@ retry: while (slot < max_entries && ret == 0) { &dhandle->session_inuse, 1); incr = 0; } - dhandle = SLIST_NEXT(dhandle, l); + dhandle = TAILQ_NEXT(dhandle, q); } /* If we reach the end of the list, we're done. */ @@ -1558,7 +1558,7 @@ __wt_cache_dump(WT_SESSION_IMPL *session) conn = S2C(session); total_bytes = 0; - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (!WT_PREFIX_MATCH(dhandle->name, "file:") || !F_ISSET(dhandle, WT_DHANDLE_OPEN)) continue; diff --git a/src/include/async.h b/src/include/async.h index cefe70f3d6f..fb9a64e774d 100644 --- a/src/include/async.h +++ b/src/include/async.h @@ -17,7 +17,7 @@ * The URI/config/format cache. */ struct __wt_async_format { - STAILQ_ENTRY(__wt_async_format) q; + TAILQ_ENTRY(__wt_async_format) q; const char *config; uint64_t cfg_hash; /* Config hash */ const char *uri; @@ -80,7 +80,7 @@ struct __wt_async { uint64_t alloc_tail; /* Next slot to dequeue */ uint64_t tail_slot; /* Worker slot consumed */ - STAILQ_HEAD(__wt_async_format_qh, __wt_async_format) formatqh; + TAILQ_HEAD(__wt_async_format_qh, __wt_async_format) formatqh; uint32_t cur_queue; /* Currently enqueued */ uint32_t max_queue; /* Maximum enqueued */ @@ -110,7 +110,7 @@ struct __wt_async { * has a cache of async cursors to reuse for operations. */ struct __wt_async_cursor { - STAILQ_ENTRY(__wt_async_cursor) q; /* Worker cache */ + TAILQ_ENTRY(__wt_async_cursor) q; /* Worker cache */ uint64_t cfg_hash; /* Config hash */ uint64_t uri_hash; /* URI hash */ WT_CURSOR *c; /* WT cursor */ @@ -122,6 +122,6 @@ struct __wt_async_cursor { */ struct __wt_async_worker_state { uint32_t id; - STAILQ_HEAD(__wt_cursor_qh, __wt_async_cursor) cursorqh; + TAILQ_HEAD(__wt_cursor_qh, __wt_async_cursor) cursorqh; uint32_t num_cursors; }; diff --git a/src/include/block.h b/src/include/block.h index 795d646db1e..ce33b331e76 100644 --- a/src/include/block.h +++ b/src/include/block.h @@ -215,8 +215,8 @@ struct __wt_block { /* A list of block manager handles, sharing a file descriptor. */ uint32_t ref; /* References */ WT_FH *fh; /* Backing file handle */ - SLIST_ENTRY(__wt_block) l; /* Linked list of handles */ - SLIST_ENTRY(__wt_block) hashl; /* Hashed list of handles */ + TAILQ_ENTRY(__wt_block) q; /* Linked list of handles */ + TAILQ_ENTRY(__wt_block) hashq; /* Hashed list of handles */ /* Configuration information, set when the file is opened. */ uint32_t allocfirst; /* Allocation is first-fit */ diff --git a/src/include/connection.h b/src/include/connection.h index 06a020b80e8..b3ffa8902a0 100644 --- a/src/include/connection.h +++ b/src/include/connection.h @@ -38,8 +38,8 @@ struct __wt_keyed_encryptor { size_t size_const; /* The result of the sizing callback */ WT_ENCRYPTOR *encryptor; /* User supplied callbacks */ /* Linked list of encryptors */ - SLIST_ENTRY(__wt_keyed_encryptor) hashl; - SLIST_ENTRY(__wt_keyed_encryptor) l; + TAILQ_ENTRY(__wt_keyed_encryptor) hashq; + TAILQ_ENTRY(__wt_keyed_encryptor) q; }; /* @@ -82,9 +82,9 @@ struct __wt_named_encryptor { const char *name; /* Name of encryptor */ WT_ENCRYPTOR *encryptor; /* User supplied callbacks */ /* Locked: list of encryptors by key */ - SLIST_HEAD(__wt_keyedhash, __wt_keyed_encryptor) - keyedhashlh[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_keyed_lh, __wt_keyed_encryptor) keyedlh; + TAILQ_HEAD(__wt_keyedhash, __wt_keyed_encryptor) + keyedhashqh[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_keyed_qh, __wt_keyed_encryptor) keyedqh; /* Linked list of encryptors */ TAILQ_ENTRY(__wt_named_encryptor) q; }; @@ -119,14 +119,13 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->dhlh, dhandle, l); \ - SLIST_INSERT_HEAD(&(conn)->dhhash[bucket], dhandle, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->dhqh, dhandle, q); \ + TAILQ_INSERT_HEAD(&(conn)->dhhash[bucket], dhandle, hashq); \ } while (0) #define WT_CONN_DHANDLE_REMOVE(conn, dhandle, bucket) do { \ - SLIST_REMOVE(&(conn)->dhlh, dhandle, __wt_data_handle, l); \ - SLIST_REMOVE(&(conn)->dhhash[bucket], \ - dhandle, __wt_data_handle, hashl); \ + TAILQ_REMOVE(&(conn)->dhqh, dhandle, q); \ + TAILQ_REMOVE(&(conn)->dhhash[bucket], dhandle, hashq); \ } while (0) /* @@ -134,14 +133,13 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_BLOCK_INSERT(conn, block, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->blocklh, block, l); \ - SLIST_INSERT_HEAD(&(conn)->blockhash[bucket], block, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->blockqh, block, q); \ + TAILQ_INSERT_HEAD(&(conn)->blockhash[bucket], block, hashq); \ } while (0) #define WT_CONN_BLOCK_REMOVE(conn, block, bucket) do { \ - SLIST_REMOVE(&(conn)->blocklh, block, __wt_block, l); \ - SLIST_REMOVE( \ - &(conn)->blockhash[bucket], block, __wt_block, hashl); \ + TAILQ_REMOVE(&(conn)->blockqh, block, q); \ + TAILQ_REMOVE(&(conn)->blockhash[bucket], block, hashq); \ } while (0) /* @@ -149,13 +147,13 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_FILE_INSERT(conn, fh, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->fhlh, fh, l); \ - SLIST_INSERT_HEAD(&(conn)->fhhash[bucket], fh, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->fhqh, fh, q); \ + TAILQ_INSERT_HEAD(&(conn)->fhhash[bucket], fh, hashq); \ } while (0) #define WT_CONN_FILE_REMOVE(conn, fh, bucket) do { \ - SLIST_REMOVE(&(conn)->fhlh, fh, __wt_fh, l); \ - SLIST_REMOVE(&(conn)->fhhash[bucket], fh, __wt_fh, hashl); \ + TAILQ_REMOVE(&(conn)->fhqh, fh, q); \ + TAILQ_REMOVE(&(conn)->fhhash[bucket], fh, hashq); \ } while (0) /* @@ -219,20 +217,20 @@ struct __wt_connection_impl { * URI. */ /* Locked: data handle hash array */ - SLIST_HEAD(__wt_dhhash, __wt_data_handle) dhhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_dhhash, __wt_data_handle) dhhash[WT_HASH_ARRAY_SIZE]; /* Locked: data handle list */ - SLIST_HEAD(__wt_dhandle_lh, __wt_data_handle) dhlh; + TAILQ_HEAD(__wt_dhandle_qh, __wt_data_handle) dhqh; /* Locked: LSM handle list. */ TAILQ_HEAD(__wt_lsm_qh, __wt_lsm_tree) lsmqh; /* Locked: file list */ - SLIST_HEAD(__wt_fhhash, __wt_fh) fhhash[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_fh_lh, __wt_fh) fhlh; + TAILQ_HEAD(__wt_fhhash, __wt_fh) fhhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_fh_qh, __wt_fh) fhqh; /* Locked: library list */ TAILQ_HEAD(__wt_dlh_qh, __wt_dlh) dlhqh; WT_SPINLOCK block_lock; /* Locked: block manager list */ - SLIST_HEAD(__wt_blockhash, __wt_block) blockhash[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_block_lh, __wt_block) blocklh; + TAILQ_HEAD(__wt_blockhash, __wt_block) blockhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_block_qh, __wt_block) blockqh; u_int open_btree_count; /* Locked: open writable btree count */ uint32_t next_file_id; /* Locked: file ID counter */ diff --git a/src/include/dhandle.h b/src/include/dhandle.h index 8bb649513c7..17af5b1f821 100644 --- a/src/include/dhandle.h +++ b/src/include/dhandle.h @@ -34,8 +34,8 @@ */ struct __wt_data_handle { WT_RWLOCK *rwlock; /* Lock for shared/exclusive ops */ - SLIST_ENTRY(__wt_data_handle) l; - SLIST_ENTRY(__wt_data_handle) hashl; + TAILQ_ENTRY(__wt_data_handle) q; + TAILQ_ENTRY(__wt_data_handle) hashq; /* * Sessions caching a connection's data handle will have a non-zero diff --git a/src/include/os.h b/src/include/os.h index edb59b0f521..518b124f547 100644 --- a/src/include/os.h +++ b/src/include/os.h @@ -77,8 +77,8 @@ typedef enum { struct __wt_fh { char *name; /* File name */ uint64_t name_hash; /* Hash of name */ - SLIST_ENTRY(__wt_fh) l; /* List of open handles */ - SLIST_ENTRY(__wt_fh) hashl; /* Hashed list of handles */ + TAILQ_ENTRY(__wt_fh) q; /* List of open handles */ + TAILQ_ENTRY(__wt_fh) hashq; /* Hashed list of handles */ u_int ref; /* Reference count */ diff --git a/src/include/schema.h b/src/include/schema.h index 8f4884281cd..0664af5adba 100644 --- a/src/include/schema.h +++ b/src/include/schema.h @@ -62,8 +62,8 @@ struct __wt_table { WT_INDEX **indices; size_t idx_alloc; - SLIST_ENTRY(__wt_table) l; - SLIST_ENTRY(__wt_table) hashl; + TAILQ_ENTRY(__wt_table) q; + TAILQ_ENTRY(__wt_table) hashq; int cg_complete, idx_complete, is_simple; u_int ncolgroups, nindices, nkey_columns; diff --git a/src/include/session.h b/src/include/session.h index f32da177bf9..c6c246954f7 100644 --- a/src/include/session.h +++ b/src/include/session.h @@ -14,8 +14,8 @@ struct __wt_data_handle_cache { WT_DATA_HANDLE *dhandle; - SLIST_ENTRY(__wt_data_handle_cache) l; - SLIST_ENTRY(__wt_data_handle_cache) hashl; + TAILQ_ENTRY(__wt_data_handle_cache) q; + TAILQ_ENTRY(__wt_data_handle_cache) hashq; }; /* @@ -66,7 +66,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { * across session close - so it is declared further down. */ /* Session handle reference list */ - SLIST_HEAD(__dhandles, __wt_data_handle_cache) dhandles; + TAILQ_HEAD(__dhandles, __wt_data_handle_cache) dhandles; time_t last_sweep; /* Last sweep for dead handles */ WT_CURSOR *cursor; /* Current cursor */ @@ -90,7 +90,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { * table of lists. The hash table list is kept in allocated memory * that lives across session close - so it is declared further down. */ - SLIST_HEAD(__tables, __wt_table) tables; + TAILQ_HEAD(__tables, __wt_table) tables; WT_ITEM **scratch; /* Temporary memory for any function */ u_int scratch_alloc; /* Currently allocated */ @@ -151,9 +151,9 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { WT_RAND_STATE rnd; /* Random number generation state */ /* Hashed handle reference list array */ - SLIST_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash; + TAILQ_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash; /* Hashed table reference list array */ - SLIST_HEAD(__tables_hash, __wt_table) *tablehash; + TAILQ_HEAD(__tables_hash, __wt_table) *tablehash; /* * Splits can "free" memory that may still be in use, and we use a diff --git a/src/include/txn.h b/src/include/txn.h index 7a67f713244..0e7be1be6bc 100644 --- a/src/include/txn.h +++ b/src/include/txn.h @@ -31,7 +31,7 @@ struct __wt_named_snapshot { const char *name; - STAILQ_ENTRY(__wt_named_snapshot) q; + TAILQ_ENTRY(__wt_named_snapshot) q; uint64_t snap_min, snap_max; uint64_t *snapshot; @@ -72,7 +72,7 @@ struct __wt_txn_global { /* Named snapshot state. */ WT_RWLOCK *nsnap_rwlock; volatile uint64_t nsnap_oldest_id; - STAILQ_HEAD(__wt_nsnap_qh, __wt_named_snapshot) nsnaph; + TAILQ_HEAD(__wt_nsnap_qh, __wt_named_snapshot) nsnaph; WT_TXN_STATE *states; /* Per-session transaction states */ }; diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c index 9a14a376650..b7bbf3614c8 100644 --- a/src/os_posix/os_open.c +++ b/src/os_posix/os_open.c @@ -53,7 +53,7 @@ __wt_open(WT_SESSION_IMPL *session, hash = __wt_hash_city64(name, strlen(name)); bucket = hash % WT_HASH_ARRAY_SIZE; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) { + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) { if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; @@ -167,7 +167,7 @@ setupfh: */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) { + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) { if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; diff --git a/src/os_posix/os_remove.c b/src/os_posix/os_remove.c index 3fc692d8755..96bbba9bab2 100644 --- a/src/os_posix/os_remove.c +++ b/src/os_posix/os_remove.c @@ -29,7 +29,7 @@ __remove_file_check(WT_SESSION_IMPL *session, const char *name) * level should have closed it before removing. */ __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(fh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(fh, &conn->fhhash[bucket], hashq) if (strcmp(name, fh->name) == 0) break; __wt_spin_unlock(session, &conn->fh_lock); diff --git a/src/os_win/os_open.c b/src/os_win/os_open.c index 4d51b101f2c..20fd1edb9c3 100644 --- a/src/os_win/os_open.c +++ b/src/os_win/os_open.c @@ -39,7 +39,7 @@ __wt_open(WT_SESSION_IMPL *session, /* Increment the reference count if we already have the file open. */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; @@ -160,7 +160,7 @@ setupfh: */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; diff --git a/src/os_win/os_remove.c b/src/os_win/os_remove.c index 0c6396c775f..55b50030064 100644 --- a/src/os_win/os_remove.c +++ b/src/os_win/os_remove.c @@ -29,7 +29,7 @@ __remove_file_check(WT_SESSION_IMPL *session, const char *name) * level should have closed it before removing. */ __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(fh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(fh, &conn->fhhash[bucket], hashq) if (strcmp(name, fh->name) == 0) break; __wt_spin_unlock(session, &conn->fh_lock); diff --git a/src/schema/schema_list.c b/src/schema/schema_list.c index a36fd696079..d091a5d94da 100644 --- a/src/schema/schema_list.c +++ b/src/schema/schema_list.c @@ -29,8 +29,8 @@ __schema_add_table(WT_SESSION_IMPL *session, WT_RET(ret); bucket = table->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_INSERT_HEAD(&session->tables, table, l); - SLIST_INSERT_HEAD(&session->tablehash[bucket], table, hashl); + TAILQ_INSERT_HEAD(&session->tables, table, q); + TAILQ_INSERT_HEAD(&session->tablehash[bucket], table, hashq); *tablep = table; return (0); @@ -51,7 +51,7 @@ __schema_find_table(WT_SESSION_IMPL *session, bucket = __wt_hash_city64(name, namelen) % WT_HASH_ARRAY_SIZE; restart: - SLIST_FOREACH(table, &session->tablehash[bucket], hashl) { + TAILQ_FOREACH(table, &session->tablehash[bucket], hashq) { tablename = table->name; (void)WT_PREFIX_SKIP(tablename, "table:"); if (WT_STRING_MATCH(tablename, name, namelen)) { @@ -228,8 +228,8 @@ __wt_schema_remove_table(WT_SESSION_IMPL *session, WT_TABLE *table) WT_ASSERT(session, table->refcnt <= 1); bucket = table->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_REMOVE(&session->tables, table, __wt_table, l); - SLIST_REMOVE(&session->tablehash[bucket], table, __wt_table, hashl); + TAILQ_REMOVE(&session->tables, table, q); + TAILQ_REMOVE(&session->tablehash[bucket], table, hashq); return (__wt_schema_destroy_table(session, &table)); } @@ -243,7 +243,7 @@ __wt_schema_close_tables(WT_SESSION_IMPL *session) WT_DECL_RET; WT_TABLE *table; - while ((table = SLIST_FIRST(&session->tables)) != NULL) + while ((table = TAILQ_FIRST(&session->tables)) != NULL) WT_TRET(__wt_schema_remove_table(session, table)); return (ret); } diff --git a/src/session/session_api.c b/src/session/session_api.c index 1103dba7409..06786db2f6d 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -1190,7 +1190,7 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, event_handler == NULL ? session->event_handler : event_handler); TAILQ_INIT(&session_ret->cursors); - SLIST_INIT(&session_ret->dhandles); + TAILQ_INIT(&session_ret->dhandles); /* * If we don't have one, allocate the dhandle hash array. * Allocate the table hash array as well. @@ -1202,8 +1202,8 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, WT_ERR(__wt_calloc(session_ret, WT_HASH_ARRAY_SIZE, sizeof(struct __tables_hash), &session_ret->tablehash)); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) { - SLIST_INIT(&session_ret->dhhash[i]); - SLIST_INIT(&session_ret->tablehash[i]); + TAILQ_INIT(&session_ret->dhhash[i]); + TAILQ_INIT(&session_ret->tablehash[i]); } /* Initialize transaction support: default to read-committed. */ diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c index b4686c8ca84..5b0d2c94868 100644 --- a/src/session/session_dhandle.c +++ b/src/session/session_dhandle.c @@ -25,8 +25,8 @@ __session_add_dhandle( dhandle_cache->dhandle = session->dhandle; bucket = dhandle_cache->dhandle->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_INSERT_HEAD(&session->dhandles, dhandle_cache, l); - SLIST_INSERT_HEAD(&session->dhhash[bucket], dhandle_cache, hashl); + TAILQ_INSERT_HEAD(&session->dhandles, dhandle_cache, q); + TAILQ_INSERT_HEAD(&session->dhhash[bucket], dhandle_cache, hashq); if (dhandle_cachep != NULL) *dhandle_cachep = dhandle_cache; @@ -273,10 +273,8 @@ __session_discard_btree( uint64_t bucket; bucket = dhandle_cache->dhandle->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_REMOVE( - &session->dhandles, dhandle_cache, __wt_data_handle_cache, l); - SLIST_REMOVE(&session->dhhash[bucket], - dhandle_cache, __wt_data_handle_cache, hashl); + TAILQ_REMOVE(&session->dhandles, dhandle_cache, q); + TAILQ_REMOVE(&session->dhhash[bucket], dhandle_cache, hashq); (void)__wt_atomic_sub4(&dhandle_cache->dhandle->session_ref, 1); __wt_overwrite_and_free(session, dhandle_cache); @@ -291,7 +289,7 @@ __wt_session_close_cache(WT_SESSION_IMPL *session) { WT_DATA_HANDLE_CACHE *dhandle_cache; - while ((dhandle_cache = SLIST_FIRST(&session->dhandles)) != NULL) + while ((dhandle_cache = TAILQ_FIRST(&session->dhandles)) != NULL) __session_discard_btree(session, dhandle_cache); } @@ -320,9 +318,9 @@ __session_dhandle_sweep(WT_SESSION_IMPL *session) WT_STAT_FAST_CONN_INCR(session, dh_session_sweeps); - dhandle_cache = SLIST_FIRST(&session->dhandles); + dhandle_cache = TAILQ_FIRST(&session->dhandles); while (dhandle_cache != NULL) { - dhandle_cache_next = SLIST_NEXT(dhandle_cache, l); + dhandle_cache_next = TAILQ_NEXT(dhandle_cache, q); dhandle = dhandle_cache->dhandle; if (dhandle != session->dhandle && dhandle->session_inuse == 0 && @@ -368,7 +366,7 @@ __session_dhandle_find( uint64_t bucket; bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; -retry: SLIST_FOREACH(dhandle_cache, &session->dhhash[bucket], hashl) { +retry: TAILQ_FOREACH(dhandle_cache, &session->dhhash[bucket], hashq) { dhandle = dhandle_cache->dhandle; if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) { WT_ASSERT(session, !WT_IS_METADATA(dhandle)); diff --git a/src/txn/txn.c b/src/txn/txn.c index 4b45a567466..96f2f72678b 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -715,7 +715,7 @@ __wt_txn_global_init(WT_SESSION_IMPL *session, const char *cfg[]) WT_RET(__wt_rwlock_alloc(session, &txn_global->nsnap_rwlock, "named snapshot lock")); txn_global->nsnap_oldest_id = WT_TXN_NONE; - STAILQ_INIT(&txn_global->nsnaph); + TAILQ_INIT(&txn_global->nsnaph); WT_RET(__wt_calloc_def( session, conn->session_size, &txn_global->states)); diff --git a/src/txn/txn_nsnap.c b/src/txn/txn_nsnap.c index bd352c2237e..d0316ecef95 100644 --- a/src/txn/txn_nsnap.c +++ b/src/txn/txn_nsnap.c @@ -34,7 +34,7 @@ __nsnap_drop_one(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name) txn_global = &S2C(session)->txn_global; - STAILQ_FOREACH(found, &txn_global->nsnaph, q) + TAILQ_FOREACH(found, &txn_global->nsnaph, q) if (WT_STRING_MATCH(found->name, name->str, name->len)) break; @@ -42,10 +42,10 @@ __nsnap_drop_one(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name) return (WT_NOTFOUND); /* Bump the global ID if we are removing the first entry */ - if (found == STAILQ_FIRST(&txn_global->nsnaph)) - txn_global->nsnap_oldest_id = (STAILQ_NEXT(found, q) != NULL) ? - STAILQ_NEXT(found, q)->snap_min : WT_TXN_NONE; - STAILQ_REMOVE(&txn_global->nsnaph, found, __wt_named_snapshot, q); + if (found == TAILQ_FIRST(&txn_global->nsnaph)) + txn_global->nsnap_oldest_id = (TAILQ_NEXT(found, q) != NULL) ? + TAILQ_NEXT(found, q)->snap_min : WT_TXN_NONE; + TAILQ_REMOVE(&txn_global->nsnaph, found, q); __nsnap_destroy(session, found); return (ret); @@ -67,7 +67,7 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) last = nsnap = prev = NULL; txn_global = &S2C(session)->txn_global; - if (STAILQ_EMPTY(&txn_global->nsnaph)) { + if (TAILQ_EMPTY(&txn_global->nsnaph)) { if (name == NULL) return (0); /* @@ -85,7 +85,7 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) */ new_nsnap_oldest = WT_TXN_NONE; if (name != NULL) { - STAILQ_FOREACH(last, &txn_global->nsnaph, q) { + TAILQ_FOREACH(last, &txn_global->nsnaph, q) { if (WT_STRING_MATCH(last->name, name->str, name->len)) break; prev = last; @@ -102,17 +102,17 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) last = prev; } - if (STAILQ_NEXT(last, q) != NULL) - new_nsnap_oldest = STAILQ_NEXT(last, q)->snap_min; + if (TAILQ_NEXT(last, q) != NULL) + new_nsnap_oldest = TAILQ_NEXT(last, q)->snap_min; } do { - nsnap = STAILQ_FIRST(&txn_global->nsnaph); + nsnap = TAILQ_FIRST(&txn_global->nsnaph); WT_ASSERT(session, nsnap != NULL); - STAILQ_REMOVE_HEAD(&txn_global->nsnaph, q); + TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); /* Last will be NULL in the all case so it will never match */ - } while (nsnap != last && !STAILQ_EMPTY(&txn_global->nsnaph)); + } while (nsnap != last && !TAILQ_EMPTY(&txn_global->nsnaph)); /* Now that the queue of named snapshots is updated, update the ID */ txn_global->nsnap_oldest_id = new_nsnap_oldest; @@ -173,9 +173,9 @@ __wt_txn_named_snapshot_begin(WT_SESSION_IMPL *session, const char *cfg[]) */ WT_ERR_NOTFOUND_OK(__nsnap_drop_one(session, &cval)); - if (STAILQ_EMPTY(&txn_global->nsnaph)) + if (TAILQ_EMPTY(&txn_global->nsnaph)) txn_global->nsnap_oldest_id = nsnap_new->snap_min; - STAILQ_INSERT_TAIL(&txn_global->nsnaph, nsnap_new, q); + TAILQ_INSERT_TAIL(&txn_global->nsnaph, nsnap_new, q); nsnap_new = NULL; err: if (started_txn) @@ -254,7 +254,7 @@ __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval) WT_RET(__wt_session_copy_values(session)); WT_RET(__wt_readlock(session, txn_global->nsnap_rwlock)); - STAILQ_FOREACH(nsnap, &txn_global->nsnaph, q) + TAILQ_FOREACH(nsnap, &txn_global->nsnaph, q) if (WT_STRING_MATCH(nsnap->name, nameval->str, nameval->len)) { txn->snap_min = txn_state->snap_min = nsnap->snap_min; txn->snap_max = nsnap->snap_max; @@ -358,10 +358,10 @@ __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) txn_global = &S2C(session)->txn_global; txn_global->nsnap_oldest_id = WT_TXN_NONE; - while (!STAILQ_EMPTY(&txn_global->nsnaph)) { - nsnap = STAILQ_FIRST(&txn_global->nsnaph); + while (!TAILQ_EMPTY(&txn_global->nsnaph)) { + nsnap = TAILQ_FIRST(&txn_global->nsnaph); WT_ASSERT(session, nsnap != NULL); - STAILQ_REMOVE_HEAD(&txn_global->nsnaph, q); + TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); } |