]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clean up size learning during pull
authorSage Weil <sage@newdream.net>
Thu, 22 Jul 2010 21:44:24 +0000 (14:44 -0700)
committerSage Weil <sage@newdream.net>
Fri, 23 Jul 2010 22:51:37 +0000 (15:51 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 4922a138f7233ad964ed0723031b8acc70381641..5ba4f6a1b94b070524a51fde7025522572d9b2eb 100644 (file)
@@ -3040,6 +3040,7 @@ bool ReplicatedPG::pull(const sobject_t& soid)
 
   map<sobject_t, interval_set<uint64_t> > clone_subsets;
   interval_set<uint64_t> data_subset;
+  bool need_size = false;
 
   // is this a snapped object?  if so, consult the snapset.. we may not need the entire object!
   if (soid.snap && soid.snap < CEPH_NOSNAP) {
@@ -3076,6 +3077,7 @@ bool ReplicatedPG::pull(const sobject_t& soid)
   } else {
     // pulling head or unversioned object.
     // always pull the whole thing.
+    need_size = true;
     data_subset.insert(0, (uint64_t)-1);
   }
 
@@ -3090,6 +3092,7 @@ bool ReplicatedPG::pull(const sobject_t& soid)
   p.from = fromosd;
   p.data_subset = data_subset;
   p.data_subset_pulling = pullsub;
+  p.need_size = need_size;
 
   send_pull_op(soid, v, true, p.data_subset_pulling, fromosd);
   
@@ -3465,9 +3468,10 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op)
     pi = &pulling[soid];
     
     // did we learn object size?
-    if (pi->data_subset.end() == (uint64_t)-1) {
+    if (pi->need_size) {
       dout(10) << " learned object size is " << op->old_size << dendl;
       pi->data_subset.erase(op->old_size, (uint64_t)-1 - op->old_size);
+      pi->need_size = false;
     }
 
     if (soid.snap && soid.snap < CEPH_NOSNAP) {
index dfc6e3acacd298e8a74ac71f8be90f4eabadad26..9cbf57e61d7120126b8acaea2dca000e563c1f40 100644 (file)
@@ -451,6 +451,7 @@ protected:
   struct pull_info_t {
     eversion_t version;
     int from;
+    bool need_size;
     interval_set<uint64_t> data_subset, data_subset_pulling;
   };
   map<sobject_t, pull_info_t> pulling;