From 1b3e4fb088ee2038f79b403761b0b9160cd538e0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 30 Apr 2010 10:46:17 -0700 Subject: [PATCH] osd: fix pg_to_acting_osds() calculation to consider pg_temp The OSD was using pg_to_up_acting, the client uses pg_to_acting, and their calculations of 'acting' weren't consistent because the latter did not consider pg_temp. Use new helpers to clean this up. Signed-off-by: Sage Weil --- src/osd/OSDMap.h | 63 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 6321076270064..ba7126948c831 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -798,48 +798,45 @@ private: } // pg -> (up osd list) - int pg_to_acting_osds(pg_t pg, - vector& osds) { // list of osd addr's - // get rush list - vector raw; - - map >::iterator p = pg_temp.find(pg); - if (p != pg_temp.end()) - raw = p->second; - else - pg_to_osds(pg, raw); - - osds.clear(); - for (unsigned i=0; i& up, vector& acting) { - // get rush list - vector raw; - pg_to_osds(pg, raw); - + void raw_to_up_osds(pg_t pg, vector& raw, vector& up) { up.clear(); for (unsigned i=0; i& raw, vector& temp) { map >::iterator p = pg_temp.find(pg); if (p != pg_temp.end()) { - raw = p->second; - acting.clear(); - for (unsigned i=0; isecond.size(); i++) { + if (!exists(p->second[i]) || is_down(p->second[i])) + continue; + temp.push_back(p->second[i]); } - } else - acting = up; + return true; + } + return false; } + int pg_to_acting_osds(pg_t pg, vector& acting) { // list of osd addr's + vector raw; + pg_to_osds(pg, raw); + if (!raw_to_temp_osds(pg, raw, acting)) + raw_to_up_osds(pg, raw, acting); + return acting.size(); + } + + + void pg_to_up_acting_osds(pg_t pg, vector& up, vector& acting) { + vector raw; + pg_to_osds(pg, raw); + raw_to_up_osds(pg, raw, up); + if (!raw_to_temp_osds(pg, raw, acting)) + acting = up; + } int lookup_pg_pool_name(const char *name) { if (name_pool.count(name)) -- 2.39.5