]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: should consider unstable_stats when publish stats to osd
authorMingxin Liu <mingxin@xsky.com>
Tue, 21 Mar 2017 10:15:51 +0000 (18:15 +0800)
committerMingxin Liu <mingxin@xsky.com>
Tue, 21 Mar 2017 10:15:55 +0000 (18:15 +0800)
Signed-off-by: Mingxin Liu <mingxin@xsky.com>
src/osd/PG.cc

index 3a75d8932e92829d7c28ef3dbbf4dcbe3e9e164b..458f7b52fdcae01b205e4b0830599f77f8e76026 100644 (file)
@@ -2712,9 +2712,11 @@ void PG::publish_stats_to_osd()
   _update_blocked_by();
 
   bool publish = false;
+  pg_stat_t pre_publish = info.stats;
+  pre_publish.stats.add(unstable_stats);
   utime_t cutoff = now;
   cutoff -= cct->_conf->osd_pg_stat_report_interval_max;
-  if (pg_stats_publish_valid && info.stats == pg_stats_publish &&
+  if (pg_stats_publish_valid && pre_publish == pg_stats_publish &&
       info.stats.last_fresh > cutoff) {
     dout(15) << "publish_stats_to_osd " << pg_stats_publish.reported_epoch
             << ": no change since " << info.stats.last_fresh << dendl;
@@ -2739,8 +2741,7 @@ void PG::publish_stats_to_osd()
 
     publish = true;
     pg_stats_publish_valid = true;
-    pg_stats_publish = info.stats;
-    pg_stats_publish.stats.add(unstable_stats);
+    pg_stats_publish = pre_publish;
 
     dout(15) << "publish_stats_to_osd " << pg_stats_publish.reported_epoch
             << ":" << pg_stats_publish.reported_seq << dendl;