From: Sage Weil Date: Thu, 15 Nov 2018 22:26:48 +0000 (-0600) Subject: mgr/ClusterState: add with_osdmap_and_pgmap X-Git-Tag: v14.1.0~902^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60876ccce4e9de7e138dc04cfac056b29a607b4c;p=ceph.git mgr/ClusterState: add with_osdmap_and_pgmap Several call sites need to lock both Signed-off-by: Sage Weil --- diff --git a/src/mgr/ClusterState.h b/src/mgr/ClusterState.h index 69fc92bfd026..c5d46fa1abfd 100644 --- a/src/mgr/ClusterState.h +++ b/src/mgr/ClusterState.h @@ -127,6 +127,17 @@ public: return objecter->with_osdmap(std::forward(args)...); } + // call cb(osdmap, pg_map, ...args) with the appropriate locks + template + 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(cb), + pg_map, + std::forward(args)...); + } + }; #endif