From 7646b7407b7cb6fe6f1b4bf3eb9e20d7cdfc5bce Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Fri, 17 Nov 2017 18:14:37 +0800 Subject: [PATCH] os/bluestore: remove lock for removed_collections. Current, queue removed-collections and handle removed-collections in the same thread. So no need a lock to protect. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 7 ++++--- src/os/bluestore/BlueStore.h | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index cd4513be7c4..fc75f36e1f9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6294,7 +6294,8 @@ BlueStore::CollectionRef BlueStore::_get_collection(const coll_t& cid) void BlueStore::_queue_reap_collection(CollectionRef& c) { dout(10) << __func__ << " " << c << " " << c->cid << dendl; - std::lock_guard l(reap_lock); + // _reap_collections and this in the same thread, + // so no need a lock. removed_collections.push_back(c); } @@ -6303,7 +6304,8 @@ void BlueStore::_reap_collections() list removed_colls; { - std::lock_guard l(reap_lock); + // _queue_reap_collection and this in the same thread. + // So no need a lock. if (!removed_collections.empty()) removed_colls.swap(removed_collections); else @@ -6333,7 +6335,6 @@ void BlueStore::_reap_collections() if (removed_colls.empty()) { dout(10) << __func__ << " all reaped" << dendl; } else { - std::lock_guard l(reap_lock); removed_collections.splice(removed_collections.begin(), removed_colls); } } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 39a9607743a..f76308d8c42 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1883,7 +1883,6 @@ private: PerfCounters *logger = nullptr; - std::mutex reap_lock; list removed_collections; RWLock debug_read_error_lock = {"BlueStore::debug_read_error_lock"}; -- 2.47.3