summaryrefslogtreecommitdiffstats
path: root/src/journal/JournalRecorder.h
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2019-11-08 20:39:58 +0100
committerJason Dillaman <dillaman@redhat.com>2019-11-19 14:45:46 +0100
commit5a5b5c58015307f686d42823ec961f7ca41e763e (patch)
tree61923f8bd9af04ab91a3bd90c2743d010c6e7a64 /src/journal/JournalRecorder.h
parentMerge pull request #29399 from ofriedma/master (diff)
downloadceph-5a5b5c58015307f686d42823ec961f7ca41e763e.tar.xz
ceph-5a5b5c58015307f686d42823ec961f7ca41e763e.zip
journal: simplify object recorder locker aggregation
Use move semantics and RAII to control the locking of the per-object recorder lock. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/journal/JournalRecorder.h')
-rw-r--r--src/journal/JournalRecorder.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/journal/JournalRecorder.h b/src/journal/JournalRecorder.h
index 3bd036fb5f7..f4edd866804 100644
--- a/src/journal/JournalRecorder.h
+++ b/src/journal/JournalRecorder.h
@@ -39,6 +39,7 @@ public:
private:
typedef std::map<uint8_t, ceph::ref_t<ObjectRecorder>> ObjectRecorderPtrs;
+ typedef std::vector<std::unique_lock<ceph::mutex>> Lockers;
struct Listener : public JournalMetadataListener {
JournalRecorder *journal_recorder;
@@ -120,17 +121,7 @@ private:
void handle_closed(ObjectRecorder *object_recorder);
void handle_overflow(ObjectRecorder *object_recorder);
- void lock_object_recorders() {
- for (auto& lock : m_object_locks) {
- lock.lock();
- }
- }
-
- void unlock_object_recorders() {
- for (auto& lock : m_object_locks) {
- lock.unlock();
- }
- }
+ Lockers lock_object_recorders();
};
} // namespace journal