diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-09-28 12:24:49 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-09-30 12:21:44 +1000 |
commit | 1600e916b0616a8f49341c6546386e366e8cdc36 (patch) | |
tree | d5073665d8c61ee29fc05be4cad993710f30a118 | |
parent | 126467ed7e6b3ad4a9b2566fe6b66dae0b763a91 (diff) | |
download | mongo-1600e916b0616a8f49341c6546386e366e8cdc36.tar.gz |
WT-2112: Boolean conversion pass over include.
Merge pull request #2221 from wiredtiger/more-bool
(cherry picked from commit d76280fa1efc6452dd3200f4b0b3639009348118)
-rw-r--r-- | src/block/block_ckpt.c | 4 | ||||
-rw-r--r-- | src/btree/bt_compact.c | 2 | ||||
-rw-r--r-- | src/btree/bt_handle.c | 4 | ||||
-rw-r--r-- | src/conn/conn_api.c | 2 | ||||
-rw-r--r-- | src/conn/conn_ckpt.c | 6 | ||||
-rw-r--r-- | src/conn/conn_log.c | 16 | ||||
-rw-r--r-- | src/conn/conn_stat.c | 6 | ||||
-rw-r--r-- | src/cursor/cur_backup.c | 4 | ||||
-rw-r--r-- | src/cursor/cur_stat.c | 16 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 4 | ||||
-rw-r--r-- | src/include/api.h | 4 | ||||
-rw-r--r-- | src/include/block.h | 2 | ||||
-rw-r--r-- | src/include/btree.h | 6 | ||||
-rw-r--r-- | src/include/connection.h | 18 | ||||
-rw-r--r-- | src/include/cursor.h | 6 | ||||
-rw-r--r-- | src/include/os.h | 2 | ||||
-rw-r--r-- | src/include/schema.h | 66 | ||||
-rw-r--r-- | src/include/session.h | 2 | ||||
-rw-r--r-- | src/include/txn.h | 2 | ||||
-rw-r--r-- | src/lsm/lsm_work_unit.c | 2 | ||||
-rw-r--r-- | src/os_posix/os_fallocate.c | 12 | ||||
-rw-r--r-- | src/os_win/os_fallocate.c | 2 | ||||
-rw-r--r-- | src/reconcile/rec_write.c | 4 | ||||
-rw-r--r-- | src/session/session_compact.c | 2 | ||||
-rw-r--r-- | src/txn/txn_log.c | 4 |
25 files changed, 99 insertions, 99 deletions
diff --git a/src/block/block_ckpt.c b/src/block/block_ckpt.c index 987da4e8456..8ff69bbf69e 100644 --- a/src/block/block_ckpt.c +++ b/src/block/block_ckpt.c @@ -656,7 +656,7 @@ live_update: } #endif - block->ckpt_inprogress = 1; + block->ckpt_inprogress = true; err: if (locked) __wt_spin_unlock(session, &block->live_lock); @@ -774,7 +774,7 @@ __wt_block_checkpoint_resolve(WT_SESSION_IMPL *session, WT_BLOCK *block) WT_RET_MSG(session, WT_ERROR, "%s: checkpoint resolved, but no checkpoint in progress", block->name); - block->ckpt_inprogress = 0; + block->ckpt_inprogress = false; __wt_spin_lock(session, &block->live_lock); ret = __wt_block_extlist_merge( diff --git a/src/btree/bt_compact.c b/src/btree/bt_compact.c index 3018d7ed3d7..e889c81c9e9 100644 --- a/src/btree/bt_compact.c +++ b/src/btree/bt_compact.c @@ -158,7 +158,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[]) if (skip) continue; - session->compaction = 1; + session->compaction = true; /* Rewrite the page: mark the page and tree dirty. */ WT_ERR(__wt_page_modify_init(session, ref->page)); __wt_page_modify_set(session, ref->page); diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index ec33300fefd..f9ddc7f2dd3 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -289,11 +289,11 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt) case BTREE_ROW: WT_RET(__wt_config_gets( session, cfg, "internal_key_truncate", &cval)); - btree->internal_key_truncate = cval.val == 0 ? 0 : 1; + btree->internal_key_truncate = cval.val != 0; WT_RET(__wt_config_gets( session, cfg, "prefix_compression", &cval)); - btree->prefix_compression = cval.val == 0 ? 0 : 1; + btree->prefix_compression = cval.val != 0; WT_RET(__wt_config_gets( session, cfg, "prefix_compression_min", &cval)); btree->prefix_compression_min = (u_int)cval.val; diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 1b7b709ed4d..4c7f1d2d442 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -1748,7 +1748,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, } WT_ERR(__wt_config_gets(session, cfg, "mmap", &cval)); - conn->mmap = cval.val == 0 ? 0 : 1; + conn->mmap = cval.val != 0; WT_ERR(__conn_statistics_config(session, cfg)); WT_ERR(__wt_lsm_manager_config(session, cfg)); diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index 6598c567de9..7fc790d5efa 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -148,7 +148,7 @@ __ckpt_server_start(WT_CONNECTION_IMPL *conn) */ WT_RET(__wt_thread_create( session, &conn->ckpt_tid, __ckpt_server, session)); - conn->ckpt_tid_set = 1; + conn->ckpt_tid_set = true; return (0); } @@ -194,7 +194,7 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session) if (conn->ckpt_tid_set) { WT_TRET(__wt_cond_signal(session, conn->ckpt_cond)); WT_TRET(__wt_thread_join(session, conn->ckpt_tid)); - conn->ckpt_tid_set = 0; + conn->ckpt_tid_set = false; } WT_TRET(__wt_cond_destroy(session, &conn->ckpt_cond)); @@ -211,7 +211,7 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session) * get confused. */ conn->ckpt_session = NULL; - conn->ckpt_tid_set = 0; + conn->ckpt_tid_set = false; conn->ckpt_cond = NULL; conn->ckpt_config = NULL; conn->ckpt_usecs = 0; diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c index 427b6a956b7..5218969c85f 100644 --- a/src/conn/conn_log.c +++ b/src/conn/conn_log.c @@ -142,7 +142,7 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file) */ __wt_spin_lock(session, &conn->hot_backup_lock); locked = true; - if (conn->hot_backup == 0 || backup_file != 0) { + if (!conn->hot_backup || backup_file != 0) { for (i = 0; i < logcount; i++) { WT_ERR(__wt_log_extract_lognum( session, logfiles[i], &lognum)); @@ -608,7 +608,7 @@ __wt_logmgr_open(WT_SESSION_IMPL *session) */ WT_RET(__wt_thread_create(conn->log_file_session, &conn->log_file_tid, __log_file_server, conn->log_file_session)); - conn->log_file_tid_set = 1; + conn->log_file_tid_set = true; /* * Start the log write LSN thread. It is not configurable. @@ -620,7 +620,7 @@ __wt_logmgr_open(WT_SESSION_IMPL *session) "log write lsn server", false, &conn->log_wrlsn_cond)); WT_RET(__wt_thread_create(conn->log_wrlsn_session, &conn->log_wrlsn_tid, __log_wrlsn_server, conn->log_wrlsn_session)); - conn->log_wrlsn_tid_set = 1; + conn->log_wrlsn_tid_set = true; /* If no log thread services are configured, we're done. */ if (!FLD_ISSET(conn->log_flags, @@ -635,7 +635,7 @@ __wt_logmgr_open(WT_SESSION_IMPL *session) */ if (conn->log_session != NULL) { WT_ASSERT(session, conn->log_cond != NULL); - WT_ASSERT(session, conn->log_tid_set != 0); + WT_ASSERT(session, conn->log_tid_set == true); WT_RET(__wt_cond_signal(session, conn->log_cond)); } else { /* The log server gets its own session. */ @@ -649,7 +649,7 @@ __wt_logmgr_open(WT_SESSION_IMPL *session) */ WT_RET(__wt_thread_create(conn->log_session, &conn->log_tid, __log_server, conn->log_session)); - conn->log_tid_set = 1; + conn->log_tid_set = true; } return (0); @@ -680,13 +680,13 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session) if (conn->log_tid_set) { WT_TRET(__wt_cond_signal(session, conn->log_cond)); WT_TRET(__wt_thread_join(session, conn->log_tid)); - conn->log_tid_set = 0; + conn->log_tid_set = false; } WT_TRET(__wt_cond_destroy(session, &conn->log_cond)); if (conn->log_file_tid_set) { WT_TRET(__wt_cond_signal(session, conn->log_file_cond)); WT_TRET(__wt_thread_join(session, conn->log_file_tid)); - conn->log_file_tid_set = 0; + conn->log_file_tid_set = false; } WT_TRET(__wt_cond_destroy(session, &conn->log_file_cond)); if (conn->log_file_session != NULL) { @@ -697,7 +697,7 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session) if (conn->log_wrlsn_tid_set) { WT_TRET(__wt_cond_signal(session, conn->log_wrlsn_cond)); WT_TRET(__wt_thread_join(session, conn->log_wrlsn_tid)); - conn->log_wrlsn_tid_set = 0; + conn->log_wrlsn_tid_set = false; } WT_TRET(__wt_cond_destroy(session, &conn->log_wrlsn_cond)); if (conn->log_wrlsn_session != NULL) { diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 707047a1542..425d824e756 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -461,7 +461,7 @@ __statlog_start(WT_CONNECTION_IMPL *conn) */ WT_RET(__wt_thread_create( session, &conn->stat_tid, __statlog_server, session)); - conn->stat_tid_set = 1; + conn->stat_tid_set = true; return (0); } @@ -511,7 +511,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close) if (conn->stat_tid_set) { WT_TRET(__wt_cond_signal(session, conn->stat_cond)); WT_TRET(__wt_thread_join(session, conn->stat_tid)); - conn->stat_tid_set = 0; + conn->stat_tid_set = false; } /* Log a set of statistics on shutdown if configured. */ @@ -532,7 +532,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close) /* Clear connection settings so reconfigure is reliable. */ conn->stat_session = NULL; - conn->stat_tid_set = 0; + conn->stat_tid_set = false; conn->stat_format = NULL; WT_TRET(__wt_fclose(session, &conn->stat_fp, WT_FHANDLE_APPEND)); conn->stat_path = NULL; diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c index 6882175362a..a4528923935 100644 --- a/src/cursor/cur_backup.c +++ b/src/cursor/cur_backup.c @@ -218,7 +218,7 @@ __backup_start( * checkpoint. */ __wt_spin_lock(session, &conn->hot_backup_lock); - conn->hot_backup = 1; + conn->hot_backup = true; __wt_spin_unlock(session, &conn->hot_backup_lock); /* Create the hot backup file. */ @@ -319,7 +319,7 @@ __backup_stop(WT_SESSION_IMPL *session) /* Checkpoint deletion can proceed, as can the next hot backup. */ __wt_spin_lock(session, &conn->hot_backup_lock); - conn->hot_backup = 0; + conn->hot_backup = false; __wt_spin_unlock(session, &conn->hot_backup_lock); return (ret); diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index 82568401319..2b054906bef 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -202,12 +202,12 @@ __curstat_next(WT_CURSOR *cursor) if (cst->notinitialized) { WT_ERR(__wt_curstat_init( session, cursor->internal_uri, cst->cfg, cst)); - cst->notinitialized = 0; + cst->notinitialized = false; } /* Move to the next item. */ if (cst->notpositioned) { - cst->notpositioned = 0; + cst->notpositioned = false; cst->key = WT_STAT_KEY_MIN(cst); } else if (cst->key < WT_STAT_KEY_MAX(cst)) ++cst->key; @@ -240,12 +240,12 @@ __curstat_prev(WT_CURSOR *cursor) if (cst->notinitialized) { WT_ERR(__wt_curstat_init( session, cursor->internal_uri, cst->cfg, cst)); - cst->notinitialized = 0; + cst->notinitialized = false; } /* Move to the previous item. */ if (cst->notpositioned) { - cst->notpositioned = 0; + cst->notpositioned = false; cst->key = WT_STAT_KEY_MAX(cst); } else if (cst->key > WT_STAT_KEY_MIN(cst)) --cst->key; @@ -275,7 +275,7 @@ __curstat_reset(WT_CURSOR *cursor) cst = (WT_CURSOR_STAT *)cursor; CURSOR_API_CALL(cursor, session, reset, NULL); - cst->notinitialized = cst->notpositioned = 1; + cst->notinitialized = cst->notpositioned = true; F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); err: API_END_RET(session, ret); @@ -302,7 +302,7 @@ __curstat_search(WT_CURSOR *cursor) if (cst->notinitialized) { WT_ERR(__wt_curstat_init( session, cursor->internal_uri, cst->cfg, cst)); - cst->notinitialized = 0; + cst->notinitialized = false; } if (cst->key < WT_STAT_KEY_MIN(cst) || cst->key > WT_STAT_KEY_MAX(cst)) @@ -580,10 +580,10 @@ __wt_curstat_open(WT_SESSION_IMPL *session, * the open returns. */ WT_ERR(__wt_curstat_init(session, uri, cst->cfg, cst)); - cst->notinitialized = 0; + cst->notinitialized = false; /* The cursor isn't yet positioned. */ - cst->notpositioned = 1; + cst->notpositioned = true; /* __wt_cursor_init is last so we don't have to clean up on error. */ WT_ERR(__wt_cursor_init(cursor, uri, NULL, cfg, cursorp)); diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index e3d5544d216..eec7c3d2f0d 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -304,7 +304,7 @@ __wt_evict_create(WT_SESSION_IMPL *session) */ WT_RET(__wt_thread_create( session, &conn->evict_tid, __evict_server, session)); - conn->evict_tid_set = 1; + conn->evict_tid_set = true; return (0); } @@ -340,7 +340,7 @@ __wt_evict_destroy(WT_SESSION_IMPL *session) if (conn->evict_tid_set) { WT_TRET(__wt_evict_server_wake(session)); WT_TRET(__wt_thread_join(session, conn->evict_tid)); - conn->evict_tid_set = 0; + conn->evict_tid_set = false; } WT_TRET(__wt_verbose( diff --git a/src/include/api.h b/src/include/api.h index eda5d327295..4514f5a42fa 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -43,7 +43,7 @@ /* An API call wrapped in a transaction if necessary. */ #define TXN_API_CALL(s, h, n, cur, bt, config, cfg) do { \ - int __autotxn = 0; \ + bool __autotxn = false; \ API_CALL(s, h, n, bt, cur, config, cfg); \ __autotxn = !F_ISSET(&(s)->txn, WT_TXN_AUTOCOMMIT | WT_TXN_RUNNING);\ if (__autotxn) \ @@ -51,7 +51,7 @@ /* An API call wrapped in a transaction if necessary. */ #define TXN_API_CALL_NOCONF(s, h, n, cur, bt) do { \ - int __autotxn = 0; \ + bool __autotxn = false; \ API_CALL_NOCONF(s, h, n, cur, bt); \ __autotxn = !F_ISSET(&(s)->txn, WT_TXN_AUTOCOMMIT | WT_TXN_RUNNING);\ if (__autotxn) \ diff --git a/src/include/block.h b/src/include/block.h index 0914e5323fc..3fe433afe47 100644 --- a/src/include/block.h +++ b/src/include/block.h @@ -237,7 +237,7 @@ struct __wt_block { */ WT_SPINLOCK live_lock; /* Live checkpoint lock */ WT_BLOCK_CKPT live; /* Live checkpoint */ - int ckpt_inprogress;/* Live checkpoint in progress */ + bool ckpt_inprogress;/* Live checkpoint in progress */ /* Compaction support */ int compact_pct_tenths; /* Percent to compact */ diff --git a/src/include/btree.h b/src/include/btree.h index d92324db560..25b528e092e 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -102,9 +102,9 @@ struct __wt_btree { * Reconciliation... */ u_int dictionary; /* Dictionary slots */ - int internal_key_truncate; /* Internal key truncate */ + bool internal_key_truncate; /* Internal key truncate */ int maximum_depth; /* Maximum tree depth */ - int prefix_compression; /* Prefix compression */ + bool prefix_compression; /* Prefix compression */ u_int prefix_compression_min; /* Prefix compression min */ #define WT_SPLIT_DEEPEN_MIN_CHILD_DEF 10000 u_int split_deepen_min_child; /* Minimum entries to deepen tree */ @@ -166,5 +166,5 @@ struct __wt_salvage_cookie { uint64_t skip; /* Initial items to skip */ uint64_t take; /* Items to take */ - int done; /* Ignore the rest */ + bool done; /* Ignore the rest */ }; diff --git a/src/include/connection.h b/src/include/connection.h index ef813b18849..6870fcb1640 100644 --- a/src/include/connection.h +++ b/src/include/connection.h @@ -234,11 +234,11 @@ struct __wt_connection_impl { WT_TXN_GLOBAL txn_global; /* Global transaction state */ WT_SPINLOCK hot_backup_lock; /* Hot backup serialization */ - int hot_backup; + bool hot_backup; WT_SESSION_IMPL *ckpt_session; /* Checkpoint thread session */ wt_thread_t ckpt_tid; /* Checkpoint thread */ - int ckpt_tid_set; /* Checkpoint thread set */ + bool ckpt_tid_set; /* Checkpoint thread set */ WT_CONDVAR *ckpt_cond; /* Checkpoint wait mutex */ const char *ckpt_config; /* Checkpoint configuration */ #define WT_CKPT_LOGSIZE(conn) ((conn)->ckpt_logsize != 0) @@ -290,7 +290,7 @@ struct __wt_connection_impl { WT_SESSION_IMPL *evict_session; /* Eviction server sessions */ wt_thread_t evict_tid; /* Eviction server thread ID */ - int evict_tid_set; /* Eviction server thread ID set */ + bool evict_tid_set; /* Eviction server thread ID set */ uint32_t evict_workers_alloc;/* Allocated eviction workers */ uint32_t evict_workers_max;/* Max eviction workers */ @@ -300,7 +300,7 @@ struct __wt_connection_impl { WT_SESSION_IMPL *stat_session; /* Statistics log session */ wt_thread_t stat_tid; /* Statistics log thread */ - int stat_tid_set; /* Statistics log thread set */ + bool stat_tid_set; /* Statistics log thread set */ WT_CONDVAR *stat_cond; /* Statistics log wait mutex */ const char *stat_format; /* Statistics log timestamp format */ FILE *stat_fp; /* Statistics log file handle */ @@ -318,15 +318,15 @@ struct __wt_connection_impl { WT_CONDVAR *log_cond; /* Log server wait mutex */ WT_SESSION_IMPL *log_session; /* Log server session */ wt_thread_t log_tid; /* Log server thread */ - int log_tid_set; /* Log server thread set */ - WT_CONDVAR *log_file_cond; /* Log file thread wait mutex */ + bool log_tid_set; /* Log server thread set */ + WT_CONDVAR *log_file_cond; /* Log file thread wait mutex */ WT_SESSION_IMPL *log_file_session;/* Log file thread session */ wt_thread_t log_file_tid; /* Log file thread thread */ - int log_file_tid_set;/* Log file thread set */ + bool log_file_tid_set;/* Log file thread set */ WT_CONDVAR *log_wrlsn_cond;/* Log write lsn thread wait mutex */ WT_SESSION_IMPL *log_wrlsn_session;/* Log write lsn thread session */ wt_thread_t log_wrlsn_tid; /* Log write lsn thread thread */ - int log_wrlsn_tid_set;/* Log write lsn thread set */ + bool log_wrlsn_tid_set;/* Log write lsn thread set */ WT_LOG *log; /* Logging structure */ WT_COMPRESSOR *log_compressor;/* Logging compressor */ wt_off_t log_file_max; /* Log file max size */ @@ -365,7 +365,7 @@ struct __wt_connection_impl { wt_off_t log_extend_len; /* file_extend log length */ uint32_t direct_io; /* O_DIRECT file type flags */ - int mmap; /* mmap configuration */ + bool mmap; /* mmap configuration */ uint32_t verbose; uint32_t flags; diff --git a/src/include/cursor.h b/src/include/cursor.h index a1c94e94817..6aa6589aba2 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -218,7 +218,7 @@ struct __wt_cursor_bulk { uint32_t nrecs; /* Max records per chunk */ /* Special bitmap bulk load for fixed-length column stores. */ - int bitmap; + bool bitmap; void *reconcile; /* Reconciliation information */ }; @@ -289,8 +289,8 @@ struct __wt_cursor_metadata { struct __wt_cursor_stat { WT_CURSOR iface; - int notinitialized; /* Cursor not initialized */ - int notpositioned; /* Cursor not positioned */ + bool notinitialized; /* Cursor not initialized */ + bool notpositioned; /* Cursor not positioned */ WT_STATS *stats; /* Stats owned by the cursor */ WT_STATS *stats_first; /* First stats reference */ diff --git a/src/include/os.h b/src/include/os.h index a8bf59f25d3..4ba588111b8 100644 --- a/src/include/os.h +++ b/src/include/os.h @@ -101,5 +101,5 @@ struct __wt_fh { WT_FALLOCATE_POSIX, WT_FALLOCATE_STD, WT_FALLOCATE_SYS } fallocate_available; - int fallocate_requires_locking; + bool fallocate_requires_locking; }; diff --git a/src/include/schema.h b/src/include/schema.h index 0f562e9ba18..f957e734faa 100644 --- a/src/include/schema.h +++ b/src/include/schema.h @@ -121,39 +121,39 @@ struct __wt_table { * Drop the schema lock and/or the handle list lock, perform an operation, * re-acquire the lock(s). */ -#define WT_WITHOUT_LOCKS(session, op) do { \ - WT_CONNECTION_IMPL *__conn = S2C(session); \ - int __handle_locked = \ - F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST);\ - int __table_locked = \ - F_ISSET(session, WT_SESSION_LOCKED_TABLE); \ - int __schema_locked = \ - F_ISSET(session, WT_SESSION_LOCKED_SCHEMA); \ - if (__handle_locked) { \ - F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST); \ - __wt_spin_unlock(session, &__conn->dhandle_lock);\ - } \ - if (__table_locked) { \ - F_CLR(session, WT_SESSION_LOCKED_TABLE); \ - __wt_spin_unlock(session, &__conn->table_lock);\ - } \ - if (__schema_locked) { \ - F_CLR(session, WT_SESSION_LOCKED_SCHEMA); \ - __wt_spin_unlock(session, &__conn->schema_lock);\ - } \ - op; \ - if (__schema_locked) { \ - __wt_spin_lock(session, &__conn->schema_lock); \ - F_SET(session, WT_SESSION_LOCKED_SCHEMA); \ - } \ - if (__table_locked) { \ - __wt_spin_lock(session, &__conn->table_lock); \ - F_SET(session, WT_SESSION_LOCKED_TABLE); \ - } \ - if (__handle_locked) { \ - __wt_spin_lock(session, &__conn->dhandle_lock); \ - F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST); \ - } \ +#define WT_WITHOUT_LOCKS(session, op) do { \ + WT_CONNECTION_IMPL *__conn = S2C(session); \ + bool __handle_locked = \ + F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST); \ + bool __table_locked = \ + F_ISSET(session, WT_SESSION_LOCKED_TABLE); \ + bool __schema_locked = \ + F_ISSET(session, WT_SESSION_LOCKED_SCHEMA); \ + if (__handle_locked) { \ + F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST); \ + __wt_spin_unlock(session, &__conn->dhandle_lock); \ + } \ + if (__table_locked) { \ + F_CLR(session, WT_SESSION_LOCKED_TABLE); \ + __wt_spin_unlock(session, &__conn->table_lock); \ + } \ + if (__schema_locked) { \ + F_CLR(session, WT_SESSION_LOCKED_SCHEMA); \ + __wt_spin_unlock(session, &__conn->schema_lock); \ + } \ + op; \ + if (__schema_locked) { \ + __wt_spin_lock(session, &__conn->schema_lock); \ + F_SET(session, WT_SESSION_LOCKED_SCHEMA); \ + } \ + if (__table_locked) { \ + __wt_spin_lock(session, &__conn->table_lock); \ + F_SET(session, WT_SESSION_LOCKED_TABLE); \ + } \ + if (__handle_locked) { \ + __wt_spin_lock(session, &__conn->dhandle_lock); \ + F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST); \ + } \ } while (0) /* diff --git a/src/include/session.h b/src/include/session.h index afcb0c94f5b..535ad07c50b 100644 --- a/src/include/session.h +++ b/src/include/session.h @@ -129,7 +129,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { void *reconcile; /* Reconciliation support */ int (*reconcile_cleanup)(WT_SESSION_IMPL *); - int compaction; /* Compaction did some work */ + bool compaction; /* Compaction did some work */ uint32_t flags; diff --git a/src/include/txn.h b/src/include/txn.h index 4f6a79eb20e..0d5f337fff0 100644 --- a/src/include/txn.h +++ b/src/include/txn.h @@ -139,7 +139,7 @@ struct __wt_txn { /* Checkpoint status. */ WT_LSN ckpt_lsn; - int full_ckpt; + bool full_ckpt; uint32_t ckpt_nsnapshot; WT_ITEM *ckpt_snapshot; diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 72c6cfb9d79..48c7bc31d7c 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -572,7 +572,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) * prevents us from removing a file that hot backup already * knows about. */ - if (S2C(session)->hot_backup != 0) + if (S2C(session)->hot_backup) break; /* diff --git a/src/os_posix/os_fallocate.c b/src/os_posix/os_fallocate.c index 142374702a1..20a9e8236ac 100644 --- a/src/os_posix/os_fallocate.c +++ b/src/os_posix/os_fallocate.c @@ -22,7 +22,7 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh) WT_UNUSED(session); fh->fallocate_available = WT_FALLOCATE_NOT_AVAILABLE; - fh->fallocate_requires_locking = 0; + fh->fallocate_requires_locking = false; /* * Check for the availability of some form of fallocate; in all cases, @@ -31,11 +31,11 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh) */ #if defined(HAVE_FALLOCATE) || defined(HAVE_POSIX_FALLOCATE) fh->fallocate_available = WT_FALLOCATE_AVAILABLE; - fh->fallocate_requires_locking = 1; + fh->fallocate_requires_locking = true; #endif #if defined(__linux__) && defined(SYS_fallocate) fh->fallocate_available = WT_FALLOCATE_AVAILABLE; - fh->fallocate_requires_locking = 1; + fh->fallocate_requires_locking = true; #endif } @@ -155,18 +155,18 @@ __wt_fallocate( */ if ((ret = __wt_std_fallocate(fh, offset, len)) == 0) { fh->fallocate_available = WT_FALLOCATE_STD; - fh->fallocate_requires_locking = 0; + fh->fallocate_requires_locking = false; return (0); } if ((ret = __wt_sys_fallocate(fh, offset, len)) == 0) { fh->fallocate_available = WT_FALLOCATE_SYS; - fh->fallocate_requires_locking = 0; + fh->fallocate_requires_locking = false; return (0); } if ((ret = __wt_posix_fallocate(fh, offset, len)) == 0) { fh->fallocate_available = WT_FALLOCATE_POSIX; #if !defined(__linux__) - fh->fallocate_requires_locking = 0; + fh->fallocate_requires_locking = false; #endif return (0); } diff --git a/src/os_win/os_fallocate.c b/src/os_win/os_fallocate.c index e0e7b356896..4b567ec3151 100644 --- a/src/os_win/os_fallocate.c +++ b/src/os_win/os_fallocate.c @@ -28,7 +28,7 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh) * We use a separate handle for file size changes, so there's no need * for locking. */ - fh->fallocate_requires_locking = 0; + fh->fallocate_requires_locking = false; } /* diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 1addf1855eb..988b7e0a84f 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -604,7 +604,7 @@ __rec_raw_compression_config( return (false); /* Raw compression cannot support prefix compression. */ - if (btree->prefix_compression != 0) + if (btree->prefix_compression) return (false); /* @@ -3624,7 +3624,7 @@ __rec_col_var_helper(WT_SESSION_IMPL *session, WT_RECONCILE *r, salvage->take = 0; } if (salvage->take == 0) - salvage->done = 1; + salvage->done = true; } } diff --git a/src/session/session_compact.c b/src/session/session_compact.c index 8f3b63ed2eb..58b6218b8c1 100644 --- a/src/session/session_compact.c +++ b/src/session/session_compact.c @@ -185,7 +185,7 @@ __compact_file(WT_SESSION_IMPL *session, const char *uri, const char *cfg[]) for (i = 0; i < 100; ++i) { WT_ERR(wt_session->checkpoint(wt_session, t->data)); - session->compaction = 0; + session->compaction = false; WT_WITH_SCHEMA_LOCK(session, ret = __wt_schema_worker( session, uri, __wt_compact, NULL, cfg, 0)); diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c index d34448efc4d..5d739083995 100644 --- a/src/txn/txn_log.c +++ b/src/txn/txn_log.c @@ -302,7 +302,7 @@ __wt_txn_checkpoint_log( switch (flags) { case WT_TXN_LOG_CKPT_PREPARE: - txn->full_ckpt = 1; + txn->full_ckpt = true; *ckpt_lsn = S2C(session)->log->write_start_lsn; /* * We need to make sure that the log records in the checkpoint @@ -371,7 +371,7 @@ __wt_txn_checkpoint_log( WT_INIT_LSN(ckpt_lsn); txn->ckpt_nsnapshot = 0; __wt_scr_free(session, &txn->ckpt_snapshot); - txn->full_ckpt = 0; + txn->full_ckpt = false; break; WT_ILLEGAL_VALUE_ERR(session); |