]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: apply osd_stat updates to pgmap correctly
authorSage Weil <sage@newdream.net>
Thu, 24 Jul 2008 18:18:26 +0000 (11:18 -0700)
committerSage Weil <sage@newdream.net>
Thu, 24 Jul 2008 18:18:26 +0000 (11:18 -0700)
src/mon/PGMonitor.cc
src/osd/OSD.cc
src/osd/osd_types.h

index 3d4e1396734396ec8827524a00055f9a52de796c..ae2ad78545ada47dd2f78f26af8d318d25e8389b 100644 (file)
@@ -265,6 +265,10 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats)
   }
       
   // osd stat
+  dout(10) << " got " << stats->osd_stat << dendl;
+  pending_inc.osd_stat_updates[from] = stats->osd_stat;
+  
+  // apply to live map too (screw consistency)
   if (pg_map.osd_stat.count(from))
     pg_map.stat_osd_sub(pg_map.osd_stat[from]);
   pg_map.osd_stat[from] = stats->osd_stat;
index 5c753c195719db92ba2d42fd3dbb6e71a501faa5..f32a00709fdacd00c3d56d227c87102d3c2d846f 100644 (file)
@@ -1105,6 +1105,7 @@ void OSD::send_pg_stats()
     m->osd_stat.num_blocks = stbuf.f_blocks;
     m->osd_stat.num_blocks_avail = stbuf.f_bavail;
     m->osd_stat.num_objects = stbuf.f_files;
+    dout(20) << " osd_stat " << m->osd_stat << dendl;
     
     int mon = monmap->pick_mon();
     messenger->send_message(m, monmap->get_inst(mon));  
index 3ff2a4a35392438c81dafa5750dc8c243426fda0..6c5ed8e2e9f51e8ec9399e4cd6c103ae38129f83 100644 (file)
@@ -253,6 +253,11 @@ struct osd_stat_t {
 WRITE_CLASS_ENCODER(osd_stat_t)
 
 
+inline ostream& operator<<(ostream& out, const osd_stat_t& s) {
+  return out << "osd_stat(" << (s.num_blocks-s.num_blocks_avail) << "/" << s.num_blocks << " used, " 
+            << s.num_objects << " objects)";
+}
+
 
 /*
  * pg states