]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: adjust pg_stats during pg split
authorSage Weil <sage@newdream.net>
Fri, 8 May 2009 04:38:26 +0000 (21:38 -0700)
committerSage Weil <sage@newdream.net>
Fri, 8 May 2009 04:49:13 +0000 (21:49 -0700)
src/TODO
src/osd/OSD.cc

index 14ef8cb771d01b9d54e4f9d315e16b28a4c0ba55..eeabfd10dacee77781e13b51a6ddef5699f274f8 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -181,7 +181,6 @@ crush
 
 osd
 - pg split should be a work queue
-- pg split needs to fix up pg stats.  this is tricky with the clone overlap business...
 - generalize ack semantics?  or just change ack from memory to journal?  memory/journal/disk...
 - rdlocks
 - optimize remove wrt recovery pushes
index ecab29d38d6abb2b0ab1a7fb262a38de2188f729..68edca94907dfd4e321facecf0c3fe780e6e792a 100644 (file)
@@ -2417,6 +2417,9 @@ void OSD::kick_pg_split_queue()
     // split
     split_pg(parent, children, t); 
 
+    parent->update_stats();
+    parent->write_info(t);
+
     // unlock parent, children
     parent->unlock();
     for (map<pg_t,PG*>::iterator q = children.begin(); q != children.end(); q++) {
@@ -2478,10 +2481,24 @@ void OSD::split_pg(PG *parent, map<pg_t,PG*>& children, ObjectStore::Transaction
       }
       t.collection_add(pgid.to_coll(), parentid.to_coll(), poid);
       t.collection_remove(parentid.to_coll(), poid);
+
+      // add to child stats
+      child->info.stats.num_bytes += st.st_size;
+      child->info.stats.num_kb += SHIFT_ROUND_UP(st.st_size, 10);
+      child->info.stats.num_objects++;
+      if (poid.snap && poid.snap != CEPH_NOSNAP)
+       child->info.stats.num_object_clones++;
     } else {
       dout(20) << " leaving " << poid << "   in " << parentid << dendl;
     }
   }
+
+  // sub off child stats
+  for (map<pg_t,PG*>::iterator p = children.begin();
+       p != children.end();
+       p++) {
+    parent->info.stats.sub(p->second->info.stats);
+  }
 }