]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: add primary-specifying pg_to_acting_osds
authorGreg Farnum <greg@inktank.com>
Fri, 20 Dec 2013 23:26:11 +0000 (15:26 -0800)
committerGreg Farnum <greg@inktank.com>
Thu, 16 Jan 2014 00:33:05 +0000 (16:33 -0800)
This works the same as pg_to_up_acting_osds

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

index 7bde573dde1fc4b6e55dedac910dcf58f6edd9c1..7bdd8e006af03537d8b41db3327887d32de8df96 100644 (file)
@@ -519,9 +519,17 @@ public:
    */
   int pg_to_osds(pg_t pg, vector<int> *raw, int *primary) const;
   /// map a pg to its acting set. @return acting set size
+  int pg_to_acting_osds(pg_t pg, vector<int> *acting,
+                        int *acting_primary) const {
+    _pg_to_up_acting_osds(pg, NULL, *acting);
+    *acting_primary = (acting->empty() ? -1 : acting->front());
+    return acting->size();
+  }
   int pg_to_acting_osds(pg_t pg, vector<int>& acting) const {
-    _pg_to_up_acting_osds(pg, NULL, acting);
-    return acting.size();
+    int primary;
+    int r = pg_to_acting_osds(pg, &acting, &primary);
+    assert(acting.empty() || primary == acting.front());
+    return r;
   }
   /**
    * This does not apply temp overrides and should not be used