ObjectState& obs = ctx->new_obs;
object_info_t& oi = obs.oi;
+ bool exists = obs.exists;
+
const sobject_t& soid = oi.soid;
ObjectStore::Transaction& t = ctx->op_t;
}
info.stats.num_wr++;
info.stats.num_wr_kb += SHIFT_ROUND_UP(op.extent.length, 10);
- ssc->snapset.head_exists = true;
+ exists = true;
}
break;
bp.copy(op.extent.length, nbl);
if (obs.exists)
t.truncate(coll, soid, 0);
+ else
+ exists = true;
t.write(coll, soid, op.extent.offset, op.extent.length, nbl);
if (ssc->snapset.clones.size()) {
snapid_t newest = *ssc->snapset.clones.rbegin();
}
info.stats.num_wr++;
info.stats.num_wr_kb += SHIFT_ROUND_UP(op.extent.length, 10);
- ssc->snapset.head_exists = true;
}
break;
add_interval_usage(ch, info.stats);
}
info.stats.num_wr++;
- ssc->snapset.head_exists = true;
} else {
// no-op
}
result = -EEXIST; /* this is an exclusive create */
else {
t.touch(coll, soid);
- ssc->snapset.head_exists = true;
+ exists = true;
}
}
break;
oi.size = op.extent.offset;
}
info.stats.num_wr++;
- // do no set head_exists, or we will break above DELETE -> TRUNCATE munging.
+ // do no set exists, or we will break above DELETE -> TRUNCATE munging.
}
break;
case CEPH_OSD_OP_SETXATTR:
{
- if (!obs.exists)
+ if (!obs.exists) {
t.touch(coll, soid);
+ exists = true;
+ }
string aname;
bp.copy(op.xattr.name_len, aname);
string name = "_" + aname;
if (!obs.exists) // create object if it doesn't yet exist.
t.touch(coll, soid);
t.setattr(coll, soid, name, bl);
- ssc->snapset.head_exists = true;
info.stats.num_wr++;
}
break;
result = -EOPNOTSUPP;
}
- if (!obs.exists && ssc->snapset.head_exists) {
+ if (!obs.exists && exists) {
dout(20) << " num_objects " << info.stats.num_objects << " -> " << (info.stats.num_objects+1) << dendl;
info.stats.num_objects++;
obs.exists = true;
// update snapset with latest snap context
ssc->snapset.seq = snapc.seq;
ssc->snapset.snaps = snapc.snaps;
+ ssc->snapset.head_exists = obs.exists;
dout(20) << "make_writeable " << soid << " done, snapset=" << ssc->snapset << dendl;
}