]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: implement pg_to_up_acting_osds with primary interface
authorGreg Farnum <greg@inktank.com>
Fri, 20 Dec 2013 21:35:28 +0000 (13:35 -0800)
committerGreg Farnum <greg@inktank.com>
Thu, 16 Jan 2014 00:33:05 +0000 (16:33 -0800)
Use our pointer calling conventions instead of a reference for the
new version of the function.

Right now we're just setting the primaries equal to the first member
of up and acting (or -1 if none), but very shortly we'll modify our
private OSDMap functions to export them based on the contents of temp_primary.
While in general anybody querying for the mapping information will
need to pay attention to whom the primary is as well, we have lots
of callers who will need real code changes to do so. To serve them,
we keep a version that does not export the primary, but asserts
that the primary matches the first entry in its list.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/OSDMap.h

index 375cf92026b9ea0f76c6548dc18f7c3c92f34aee..7bde573dde1fc4b6e55dedac910dcf58f6edd9c1 100644 (file)
@@ -533,10 +533,19 @@ public:
    * the acting set for data mapping purposes, but some users will
    * also find the up set useful for things like deciding what to
    * set as pg_temp.
+   * Each of these pointers must be non-NULL.
    */
-  void pg_to_up_acting_osds(pg_t pg, vector<int>& up,
-                            vector<int>& acting) const {
-    _pg_to_up_acting_osds(pg, &up, acting);
+  void pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
+                            vector<int> *acting, int *acting_primary) const {
+    _pg_to_up_acting_osds(pg, up, *acting);
+    *up_primary = (up->empty() ? -1 : up.front());
+    *acting_primary = (acting->empty() ?  -1 : acting.front());
+  }
+  void pg_to_up_acting_osds(pg_t pg, vector<int>& up, vector<int>& acting) const {
+    int up_primary, acting_primary;
+    pg_to_up_acting_osds(pg, &up, &up_primary, &acting, &acting_primary);
+    assert(up.empty() || up_primary == up.front());
+    assert(acting.empty() || acting_primary == acting.front());
   }
 
   int64_t lookup_pg_pool_name(const string& name) {