From fa8607bae02d091b106518110330392032880168 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 9 Jan 2017 23:23:32 -0500 Subject: [PATCH] crucible: get rid of DefaultBool, just use C++11 initializer syntax Signed-off-by: Zygo Blaxell --- include/crucible/bool.h | 13 ------------- src/bees.h | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 include/crucible/bool.h diff --git a/include/crucible/bool.h b/include/crucible/bool.h deleted file mode 100644 index 75f6cbe..0000000 --- a/include/crucible/bool.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CRUCIBLE_BOOL_H -#define CRUCIBLE_BOOL_H - -namespace crucible { - struct DefaultBool { - bool m_b; - DefaultBool(bool init = false) : m_b(init) {} - operator bool() const { return m_b; } - bool &operator=(const bool &that) { return m_b = that; } - }; -} - -#endif // CRUCIBLE_BOOL_H diff --git a/src/bees.h b/src/bees.h index 506f10d..5aabdd0 100644 --- a/src/bees.h +++ b/src/bees.h @@ -1,7 +1,6 @@ #ifndef BEES_H #define BEES_H -#include "crucible/bool.h" #include "crucible/cache.h" #include "crucible/chatter.h" #include "crucible/error.h" @@ -487,7 +486,7 @@ class BeesCrawl { mutex m_mutex; set m_extents; - DefaultBool m_deferred; + bool m_deferred = false; mutex m_state_mutex; BeesCrawlState m_state; @@ -512,7 +511,7 @@ class BeesRoots { map> m_root_crawl_map; mutex m_mutex; condition_variable m_condvar; - DefaultBool m_crawl_dirty; + bool m_crawl_dirty = false; Timer m_crawl_timer; BeesThread m_crawl_thread; BeesThread m_writeback_thread; @@ -568,7 +567,7 @@ class BeesBlockData { mutable BeesAddress m_addr; mutable Blob m_data; mutable BeesHash m_hash; - mutable DefaultBool m_hash_done; + mutable bool m_hash_done = false; public: // Constructor with the immutable fields @@ -672,7 +671,7 @@ public: struct BeesResolveAddrResult { BeesResolveAddrResult(); vector m_biors; - DefaultBool m_is_toxic; + bool m_is_toxic = false; bool is_toxic() const { return m_is_toxic; } }; @@ -750,22 +749,22 @@ class BeesResolver { unsigned m_bior_count; // We found matching data, so we can dedup - DefaultBool m_found_data; + bool m_found_data = false; // We found matching data, so we *did* dedup - DefaultBool m_found_dup; + bool m_found_dup = false; // We found matching hash, so the hash table is still correct - DefaultBool m_found_hash; + bool m_found_hash = false; // We found matching physical address, so the hash table isn't totally wrong - DefaultBool m_found_addr; + bool m_found_addr = false; // We found matching physical address, but data did not match - DefaultBool m_wrong_data; + bool m_wrong_data = false; // The whole thing is a placebo to avoid crippling btrfs performance bugs - DefaultBool m_is_toxic; + bool m_is_toxic = false; BeesFileRange chase_extent_ref(const BtrfsInodeOffsetRoot &bior, BeesBlockData &needle_bbd); BeesBlockData adjust_offset(const BeesFileRange &haystack, const BeesBlockData &needle);