From: Sage Weil Date: Wed, 10 Oct 2018 17:37:46 +0000 (-0500) Subject: os/bluestore: std::{mutex,condition_variable} -> ceph::{mutex,condition_variable} X-Git-Tag: v14.0.1~18^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6cfc12b0b8da2ed5d4d6ff87de1e8646837ca741;p=ceph.git os/bluestore: std::{mutex,condition_variable} -> ceph::{mutex,condition_variable} Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BitmapFreelistManager.h b/src/os/bluestore/BitmapFreelistManager.h index e9dabbbeeb19..ed80b70a0272 100644 --- a/src/os/bluestore/BitmapFreelistManager.h +++ b/src/os/bluestore/BitmapFreelistManager.h @@ -9,6 +9,7 @@ #include #include +#include "common/ceph_mutex.h" #include "include/buffer.h" #include "kv/KeyValueDB.h" @@ -16,7 +17,7 @@ class BitmapFreelistManager : public FreelistManager { std::string meta_prefix, bitmap_prefix; KeyValueDB *kvdb; std::shared_ptr merge_op; - std::mutex lock; + ceph::mutex lock = ceph::make_mutex("BitmapFreelistManager::lock"); uint64_t size; ///< size of device (bytes) uint64_t bytes_per_block; ///< bytes per block (bdev_block_size) diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 185abbf35b90..0fc48a5ce826 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -27,6 +27,8 @@ #include #include "acconfig.h" +#include "common/ceph_mutex.h" + #ifdef HAVE_LIBAIO #include "aio.h" #endif @@ -40,8 +42,8 @@ class CephContext; /// track in-flight io struct IOContext { private: - std::mutex lock; - std::condition_variable cond; + ceph::mutex lock = ceph::make_mutex("IOContext::lock"); + ceph::condition_variable cond; int r = 0; public: @@ -104,7 +106,7 @@ public: CephContext* cct; typedef void (*aio_callback_t)(void *handle, void *aio); private: - std::mutex ioc_reap_lock; + ceph::mutex ioc_reap_lock = ceph::make_mutex("BlockDevice::ioc_reap_lock"); std::vector ioc_reap_queue; std::atomic_int ioc_reap_count = {0}; diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index af9a516391ee..bbd98dcdcfa9 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1318,7 +1318,7 @@ void BlueFS::_compact_log_sync() * * 8. Release the old log space. Clean up. */ -void BlueFS::_compact_log_async(std::unique_lock& l) +void BlueFS::_compact_log_async(std::unique_lock& l) { dout(10) << __func__ << dendl; File *log_file = log_writer->file.get(); @@ -1476,7 +1476,7 @@ void BlueFS::flush_log() _flush_and_sync_log(l); } -int BlueFS::_flush_and_sync_log(std::unique_lock& l, +int BlueFS::_flush_and_sync_log(std::unique_lock& l, uint64_t want_seq, uint64_t jump_to) { @@ -1919,7 +1919,7 @@ int BlueFS::_truncate(FileWriter *h, uint64_t offset) return 0; } -int BlueFS::_fsync(FileWriter *h, std::unique_lock& l) +int BlueFS::_fsync(FileWriter *h, std::unique_lock& l) { dout(10) << __func__ << " " << h << " " << h->file->fnode << dendl; int r = _flush(h, true); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index a761f8150cb0..f27c2f3af299 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -125,7 +125,7 @@ public: bufferlist::page_aligned_appender buffer_appender; //< for const char* only int writer_type = 0; ///< WRITER_* - std::mutex lock; + ceph::mutex lock = ceph::make_mutex("BlueFS::FileWriter::lock"); std::array iocv; ///< for each bdev std::array dirty_devs; @@ -219,7 +219,7 @@ public: }; private: - std::mutex lock; + ceph::mutex lock = ceph::make_mutex("BlueFS::lock"); PerfCounters *logger = nullptr; @@ -237,7 +237,7 @@ private: FileWriter *log_writer = 0; ///< writer for the log bluefs_transaction_t log_t; ///< pending, unwritten log transaction bool log_flushing = false; ///< true while flushing the log - std::condition_variable log_cond; + ceph::condition_variable log_cond; uint64_t new_log_jump_to = 0; uint64_t old_log_jump_to = 0; @@ -275,21 +275,21 @@ private: bluefs_fnode_t* node); int _flush_range(FileWriter *h, uint64_t offset, uint64_t length); int _flush(FileWriter *h, bool force); - int _fsync(FileWriter *h, std::unique_lock& l); + int _fsync(FileWriter *h, std::unique_lock& l); #ifdef HAVE_LIBAIO void _claim_completed_aios(FileWriter *h, list *ls); void wait_for_aio(FileWriter *h); // safe to call without a lock #endif - int _flush_and_sync_log(std::unique_lock& l, + int _flush_and_sync_log(std::unique_lock& l, uint64_t want_seq = 0, uint64_t jump_to = 0); uint64_t _estimate_log_size(); bool _should_compact_log(); void _compact_log_dump_metadata(bluefs_transaction_t *t); void _compact_log_sync(); - void _compact_log_async(std::unique_lock& l); + void _compact_log_async(std::unique_lock& l); //void _aio_finish(void *priv); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 52fedd6cceea..19e544fa75e5 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -438,7 +438,8 @@ public: /// a lookup table of SharedBlobs struct SharedBlobSet { - std::mutex lock; ///< protect lookup, insertion, removal + /// protect lookup, insertion, removal + ceph::mutex lock = ceph::make_mutex("BlueStore::SharedBlobSet::lock"); // we use a bare pointer because we don't want to affect the ref // count @@ -1039,8 +1040,9 @@ public: // track txc's that have not been committed to kv store (and whose // effects cannot be read via the kvdb read methods) std::atomic flushing_count = {0}; - std::mutex flush_lock; ///< protect flush_txns - std::condition_variable flush_cond; ///< wait here for uncommitted txns + /// protect flush_txns + ceph::mutex flush_lock = ceph::make_mutex("BlueStore::Onode::flush_lock"); + ceph::condition_variable flush_cond; ///< wait here for uncommitted txns Onode(Collection *c, const ghobject_t& o, const mempool::bluestore_cache_other::string& k) @@ -1675,8 +1677,8 @@ public: class OpSequencer : public RefCountedObject { public: - std::mutex qlock; - std::condition_variable qcond; + ceph::mutex qlock = ceph::make_mutex("BlueStore::OpSequencer::qlock"); + ceph::condition_variable qcond; typedef boost::intrusive::list< TransContext, boost::intrusive::member_hook< @@ -1864,7 +1866,8 @@ private: vector cache_shards; - std::mutex zombie_osr_lock; ///< protect zombie_osr_set + /// protect zombie_osr_set + ceph::mutex zombie_osr_lock = ceph::make_mutex("BlueStore::zombie_osr_lock"); std::map zombie_osr_set; ///< set of OpSequencers for deleted collections std::atomic nid_last = {0}; @@ -1878,7 +1881,7 @@ private: interval_set bluefs_extents; ///< block extents owned by bluefs interval_set bluefs_extents_reclaiming; ///< currently reclaiming - std::mutex deferred_lock; + ceph::mutex deferred_lock = ceph::make_mutex("BlueStore::deferred_lock"); std::atomic deferred_seq = {0}; deferred_osr_queue_t deferred_queue; ///< osr's with deferred io pending int deferred_queue_size = 0; ///< num txc's queued across all osrs @@ -1886,8 +1889,8 @@ private: Finisher deferred_finisher, finisher; KVSyncThread kv_sync_thread; - std::mutex kv_lock; - std::condition_variable kv_cond; + ceph::mutex kv_lock = ceph::make_mutex("BlueStore::kv_lock"); + ceph::condition_variable kv_cond; bool _kv_only = false; bool kv_sync_started = false; bool kv_stop = false; @@ -1899,8 +1902,8 @@ private: deque deferred_done_queue; ///< deferred ios done KVFinalizeThread kv_finalize_thread; - std::mutex kv_finalize_lock; - std::condition_variable kv_finalize_cond; + ceph::mutex kv_finalize_lock = ceph::make_mutex("BlueStore::kv_finalize_lock"); + ceph::condition_variable kv_finalize_cond; deque kv_committing_to_finalize; ///< pending finalization deque deferred_stable_to_finalize; ///< pending finalization @@ -1961,7 +1964,7 @@ private: double osd_memory_expected_fragmentation = 0; ///< expected memory fragmentation uint64_t osd_memory_cache_min = 0; ///< Min memory to assign when autotuning cache double osd_memory_cache_resize_interval = 0; ///< Time to wait between cache resizing - std::mutex vstatfs_lock; + ceph::mutex vstatfs_lock = ceph::make_mutex("BlueStore::vstatfs_lock"); volatile_statfs vstatfs; struct MempoolThread : public Thread { diff --git a/src/os/bluestore/KernelDevice.h b/src/os/bluestore/KernelDevice.h index 9f461ac06302..2e9463fcc63f 100644 --- a/src/os/bluestore/KernelDevice.h +++ b/src/os/bluestore/KernelDevice.h @@ -39,7 +39,7 @@ class KernelDevice : public BlockDevice { interval_set debug_inflight; std::atomic io_since_flush = {false}; - std::mutex flush_mutex; + ceph::mutex flush_mutex = ceph::make_mutex("KernelDevice::flush_mutex"); aio_queue_t aio_queue; aio_callback_t discard_callback; @@ -48,8 +48,8 @@ class KernelDevice : public BlockDevice { bool discard_started; bool discard_stop; - std::mutex discard_lock; - std::condition_variable discard_cond; + ceph::mutex discard_lock = ceph::make_mutex("KernelDevice::discard_lock"); + ceph::condition_variable discard_cond; bool discard_running = false; interval_set discard_queued; interval_set discard_finishing; @@ -95,7 +95,7 @@ class KernelDevice : public BlockDevice { // stalled aio debugging aio_list_t debug_queue; - std::mutex debug_queue_lock; + ceph::mutex debug_queue_lock = ceph::make_mutex("KernelDevice::debug_queue_lock"); aio_t *debug_oldest = nullptr; utime_t debug_stall_since; void debug_aio_link(aio_t& aio); diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index 293259e43ebb..aecadb6e8c42 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -228,8 +228,8 @@ struct Task { int64_t return_code; ceph::coarse_real_clock::time_point start; IORequest io_request; - std::mutex lock; - std::condition_variable cond; + ceph::mutex lock = ceph::make_mutex("Task::lock"); + ceph::condition_variable cond; SharedDriverQueueData *queue = nullptr; Task(NVMEDevice *dev, IOCommand c, uint64_t off, uint64_t l, int64_t rc = 0) : device(dev), command(c), offset(off), len(l), @@ -485,8 +485,8 @@ class NVMEManager { bool init = false; std::vector shared_driver_datas; std::thread dpdk_thread; - std::mutex probe_queue_lock; - std::condition_variable probe_queue_cond; + ceph::mutex probe_queue_lock = ceph::make_mutex("NVMEManager::probe_queue_lock"); + ceph::condition_variable probe_queue_cond; std::list probe_queue; public: diff --git a/src/os/bluestore/StupidAllocator.h b/src/os/bluestore/StupidAllocator.h index c994cc718e45..6c6e7832f7ef 100644 --- a/src/os/bluestore/StupidAllocator.h +++ b/src/os/bluestore/StupidAllocator.h @@ -11,10 +11,11 @@ #include "include/interval_set.h" #include "os/bluestore/bluestore_types.h" #include "include/mempool.h" +#include "common/ceph_mutex.h" class StupidAllocator : public Allocator { CephContext* cct; - std::mutex lock; + ceph::mutex lock = ceph::make_mutex("StupidAllocator::lock"); int64_t num_free; ///< total bytes in freelist diff --git a/src/os/bluestore/fastbmap_allocator_impl.h b/src/os/bluestore/fastbmap_allocator_impl.h index 83b6bbbb221a..a27f69f96288 100755 --- a/src/os/bluestore/fastbmap_allocator_impl.h +++ b/src/os/bluestore/fastbmap_allocator_impl.h @@ -35,6 +35,7 @@ typedef std::vector slot_vector_t; #include "common/likely.h" #include "os/bluestore/bluestore_types.h" #include "include/mempool.h" +#include "common/ceph_mutex.h" typedef bluestore_pextent_t interval_t; typedef PExtentVector interval_vector_t; @@ -503,7 +504,7 @@ public: } protected: - std::mutex lock; + ceph::mutex lock = ceph::make_mutex("AllocatorLevel02::lock"); L1 l1; slot_vector_t l2; uint64_t l2_granularity = 0; // space per entry