From 045e1d75a705b377ae551040b88b8f9eddfecc69 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 20 Dec 2013 15:26:11 -0800 Subject: [PATCH] OSDMap: add primary-specifying pg_to_acting_osds This works the same as pg_to_up_acting_osds Signed-off-by: Greg Farnum --- src/osd/OSDMap.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 7bde573dde1..7bdd8e006af 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -519,9 +519,17 @@ public: */ int pg_to_osds(pg_t pg, vector *raw, int *primary) const; /// map a pg to its acting set. @return acting set size + int pg_to_acting_osds(pg_t pg, vector *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& 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