From bb4ad56d4da32629ec1db0442c22eb0c2fe74652 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 19 May 2008 22:51:06 -0700 Subject: [PATCH] osd: update pg stats more reliably --- src/osd/OSD.cc | 10 ++++++---- src/osd/PG.cc | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e8ef8b8fbe681..7079e3395eca1 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1741,7 +1741,7 @@ void OSD::activate_map(ObjectStore::Transaction& t) // update started counter pg->info.history.last_epoch_started = osdmap->get_epoch(); } - else if (pg->get_role() == 0 && !pg->is_active()) { + else if (pg->is_primary() && !pg->is_active()) { // i am (inactive) primary pg->build_prior(); pg->peer(t, query_map, &info_map); @@ -1996,7 +1996,7 @@ void OSD::kick_pg_split_queue() waiting_for_pg.erase(pg->info.pgid); } pg->peer(t, query_map, &info_map); - + pg->update_stats(); pg->unlock(); created++; } @@ -2131,6 +2131,7 @@ void OSD::handle_pg_create(MOSDPGCreate *m) waiting_for_pg.erase(pgid); } pg->peer(t, query_map, &info_map); + pg->update_stats(); pg->unlock(); } } @@ -2291,7 +2292,7 @@ void OSD::handle_pg_notify(MOSDPGNotify *m) } // ok! - dout(10) << *pg << " osd" << from << " " << *it << dendl; + dout(10) << *pg << " got osd" << from << " info " << *it << dendl; pg->info.history.merge(it->history); // save info. @@ -2323,7 +2324,7 @@ void OSD::handle_pg_notify(MOSDPGNotify *m) pg->build_prior(); pg->peer(t, query_map, &info_map); } - + pg->update_stats(); pg->unlock(); } @@ -2407,6 +2408,7 @@ void OSD::_process_pg_info(epoch_t epoch, int from, // peer map< int, map > query_map; pg->peer(t, query_map, info_map); + pg->update_stats(); do_queries(query_map); } else { diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 95d3c225b5a91..f22b10ad1c0e0 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -881,6 +881,8 @@ void PG::peer(ObjectStore::Transaction& t, } else if (is_all_uptodate()) finish_recovery(); + + update_stats(); // update stats } -- 2.39.5