]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: refactor object_info_t constructor a bit
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 30 Nov 2010 23:04:15 +0000 (15:04 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 30 Nov 2010 23:48:49 +0000 (15:48 -0800)
Create a copy constructor for object_info_t, since we often want to copy
an object_info_t and would rather not try to remember all the fields.
Drop the lost parameter from one of the other constructors, because it's
not used that much.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/osd/PG.cc
src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index 78fafbb3d9d56c2d6f291770dc759a599e0e62bd..91d78eeaace7e4b6cac836959f2bb99f1b58fd8f 100644 (file)
@@ -1014,7 +1014,7 @@ void PG::mark_obj_as_lost(ObjectStore::Transaction& t,
   object_locator_t oloc;
   oloc.clear();
   oloc.pool = info.pgid.pool();
-  object_info_t oi(lost_soid, oloc, true);
+  object_info_t oi(lost_soid, oloc);
 
   if (r >= 0) {
     // Some version of this lost object exists in our filestore.
index d69e690b8f9bae8bcf13c448ebc5515bf8473d95..06481e7f0730f3140f144fed70db9d89d040f93e 100644 (file)
@@ -1703,7 +1703,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
       snaps[i] = snapc.snaps[i];
     
     // prepare clone
-    object_info_t static_snap_oi(coid, oi.oloc, oi.lost);
+    object_info_t static_snap_oi(oi);
     object_info_t *snap_oi;
     if (is_primary()) {
       ctx->clone_obc = new ObjectContext(static_snap_oi, true, NULL);
@@ -2301,7 +2301,7 @@ ReplicatedPG::ObjectContext *ReplicatedPG::get_object_context(const sobject_t& s
     if (r < 0) {
       if (!can_create)
        return NULL;   // -ENOENT!
-      object_info_t oi(soid, oloc, false);
+      object_info_t oi(soid, oloc);
       obc = new ObjectContext(oi, false, NULL);
     }
     else {
@@ -2559,7 +2559,8 @@ void ReplicatedPG::sub_op_modify(MOSDSubOp *op)
       // TODO: this is severely broken because we don't know whether this object is really lost or
       // not. We just always assume that it's not right now.
       // Also, we're taking the address of a variable on the stack. 
-      object_info_t oi(soid, op->oloc, false);
+      object_info_t oi(soid, op->oloc);
+      oi.lost = false; // I guess?
       oi.version = op->old_version;
       oi.size = op->old_size;
       ObjectState obs(oi, op->old_exists, NULL);
@@ -3754,7 +3755,7 @@ int ReplicatedPG::recover_primary(int max)
 
            ObjectContext *headobc = get_object_context(head, OLOC_BLANK, false);
 
-           object_info_t oi(soid, headobc->obs.oi.oloc, headobc->obs.oi.lost);
+           object_info_t oi(headobc->obs.oi);
            oi.version = latest->version;
            oi.prior_version = latest->prior_version;
            ::decode(oi.snaps, latest->snaps);
index 3005a83b79eb9ea83f5f0e57e1e88e4554343bb3..784da1d12a8ef0aa5f2c0eaf24cbc29daee80d3f 100644 (file)
@@ -1353,9 +1353,15 @@ struct object_info_t {
     decode(p);
   }
 
-  object_info_t(const sobject_t& s, const object_locator_t& o, bool lost_) :
-    soid(s), size(0),
-    lost(lost_), truncate_seq(0), truncate_size(0) {}
+  object_info_t(const object_info_t &rhs)
+    : soid(rhs.soid), size(rhs.size),
+      lost(rhs.lost), truncate_seq(rhs.truncate_seq),
+      truncate_size(rhs.truncate_size) {}
+
+  object_info_t(const sobject_t& s, const object_locator_t& o)
+    : soid(s), size(0),
+      lost(false), truncate_seq(0), truncate_size(0) {}
+
   object_info_t(bufferlist& bl) {
     decode(bl);
   }