mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
osd: refactor object_info_t constructor a bit
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>
This commit is contained in:
parent
cee3cd51fc
commit
0cc8d34e7f
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user