]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ClusterState: add with_osdmap_and_pgmap
authorSage Weil <sage@redhat.com>
Thu, 15 Nov 2018 22:26:48 +0000 (16:26 -0600)
committerSage Weil <sage@redhat.com>
Thu, 15 Nov 2018 22:26:48 +0000 (16:26 -0600)
Several call sites need to lock both

Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/ClusterState.h

index 69fc92bfd026a19ff52a704ef4f3b77249f02ca5..c5d46fa1abfd53e21ab8bf6b9bf84ad417416146 100644 (file)
@@ -127,6 +127,17 @@ public:
     return objecter->with_osdmap(std::forward<Args>(args)...);
   }
 
+  // call cb(osdmap, pg_map, ...args) with the appropriate locks
+  template <typename Callback, typename ...Args>
+  auto with_osdmap_and_pgmap(Callback&& cb, Args&& ...args) const {
+    ceph_assert(objecter != nullptr);
+    std::lock_guard l(lock);
+    return objecter->with_osdmap(
+      std::forward<Callback>(cb),
+      pg_map,
+      std::forward<Args>(args)...);
+  }
+
 };
 
 #endif