"osd_max_object_size");
PGTransaction* t = ctx->op_t.get();
- if (!oi.has_extents() &&
- get_osdmap()->require_osd_release >= CEPH_RELEASE_MIMIC) {
- assert(oi.extents.empty());
- // note that this is ok because:
- // 1. for reads, this should have no effect
- // 2. for writes, we check if this is a pre-mimic created object
- // (with FLAG_EXTENTS off). And if it is, we set FLAG_EXTENTS
- // and initialize extents with a whole entry - [0, oi.size) only
- // to make sure we have oi.extents.size() == oi.size at the very
- // beginning, which is necessary for backward compatibility.
- oi.set_flag(object_info_t::FLAG_EXTENTS);
- if (oi.size) {
- oi.extents.insert(0, oi.size);
- }
- }
dout(10) << "do_osd_op " << soid << " " << ops << dendl;
ctx->modified_ranges.union_of(ch);
ctx->delta_stats.num_wr++;
oi.clear_data_digest();
- if (oi.has_extents()) {
- int64_t old_bytes = oi.extents.size();
- interval_set<uint64_t> to_remove;
- to_remove.subset_of(oi.extents, op.extent.offset,
- op.extent.offset + op.extent.length);
- oi.extents.subtract(to_remove);
- int64_t new_bytes = oi.extents.size();
- ctx->delta_stats.num_bytes += new_bytes - old_bytes;
- }
} else {
// no-op
}
obs.oi.clear_omap_digest();
obs.oi.clear_flag(object_info_t::FLAG_OMAP);
}
- if (oi.has_extents()) {
- ctx->delta_stats.num_bytes -= oi.extents.size();
- oi.extents.clear();
- } else {
- ctx->delta_stats.num_bytes -= oi.size;
- }
+ ctx->delta_stats.num_bytes -= oi.size;
oi.size = 0;
oi.new_object();
oi.user_version = target_version;
assert(ctx->obc->ssc->snapset.clone_overlap.count(soid.snap));
ctx->delta_stats.num_bytes -= ctx->obc->ssc->snapset.get_clone_bytes(soid.snap);
} else {
- if (oi.has_extents()) {
- ctx->delta_stats.num_bytes -= oi.extents.size();
- oi.extents.clear();
- } else {
- ctx->delta_stats.num_bytes -= oi.size;
- }
+ ctx->delta_stats.num_bytes -= oi.size;
}
oi.size = 0;
oi.new_object();
// Adjust the cached objectcontext
maybe_create_new_object(ctx, true);
- if (obs.oi.has_extents()) {
- ctx->delta_stats.num_bytes -= obs.oi.extents.size();
- obs.oi.extents.clear();
- } else {
- ctx->delta_stats.num_bytes -= obs.oi.size;
- }
- if (rollback_to->obs.oi.has_extents()) {
- ctx->delta_stats.num_bytes += rollback_to->obs.oi.extents.size();
- // transfer extents map too
- assert(obs.oi.has_extents());
- obs.oi.extents = rollback_to->obs.oi.extents;
- } else {
- ctx->delta_stats.num_bytes += rollback_to->obs.oi.size;
- if (obs.oi.has_extents() && rollback_to->obs.oi.size) {
- obs.oi.extents.insert(0, rollback_to->obs.oi.size);
- }
- }
+ ctx->delta_stats.num_bytes -= obs.oi.size;
+ ctx->delta_stats.num_bytes += rollback_to->obs.oi.size;
obs.oi.size = rollback_to->obs.oi.size;
if (rollback_to->obs.oi.is_data_digest())
obs.oi.set_data_digest(rollback_to->obs.oi.data_digest);
modified.union_of(ch);
if (write_full || offset + length > oi.size) {
uint64_t new_size = offset + length;
- if (!oi.has_extents()) {
- delta_stats.num_bytes -= oi.size;
- delta_stats.num_bytes += new_size;
- }
+ delta_stats.num_bytes -= oi.size;
+ delta_stats.num_bytes += new_size;
oi.size = new_size;
}
- if (oi.has_extents()) {
- delta_stats.num_bytes -= oi.extents.size();
- if (write_full) {
- // oi.size may shrink
- oi.extents.clear();
- assert(offset == 0);
- if (length) {
- oi.extents.insert(0, length);
- }
- } else {
- if (length) {
- oi.extents.union_of(ch); // deduplicated
- }
- }
- delta_stats.num_bytes += oi.extents.size();
- }
-
+
if (oi.has_manifest() && oi.manifest.is_chunked()) {
for (auto &p : oi.manifest.chunk_map) {
if ((p.first <= offset && p.first + p.second.length > offset) ||
object_info_t& oi,
uint64_t truncate_size)
{
- if (oi.size == truncate_size) {
- // no change
- return;
- }
- if (oi.has_extents()) {
- int64_t old_bytes = oi.extents.size();
- if (truncate_size > oi.size) {
- // trunc up
- oi.extents.insert(oi.size, truncate_size - oi.size);
- } else {
- // trunc down
- interval_set<uint64_t> new_extents;
- new_extents.subset_of(oi.extents, 0, truncate_size);
- oi.extents.swap(new_extents);
- }
- int64_t new_bytes = oi.extents.size();
- delta_stats.num_bytes += new_bytes - old_bytes;
- } else {
- // fall back to old fashion
+ if (oi.size != truncate_size) {
delta_stats.num_bytes -= oi.size;
delta_stats.num_bytes += truncate_size;
+ oi.size = truncate_size;
}
- oi.size = truncate_size;
}
void PrimaryLogPG::complete_disconnect_watches(
// but it works...
pg_log.get_log().get_object_reqids(ctx->obc->obs.oi.soid, 10, &reply_obj.reqids);
dout(20) << " got reqids" << dendl;
- if (oi.has_extents()) {
- // note that we might call this multiple times
- // include extents only in the final step to make extents.insert happy
- reply_obj.flags |= object_copy_data_t::FLAG_EXTENTS;
- reply_obj.extents = oi.extents;
- }
}
dout(20) << " cursor.is_complete=" << cursor.is_complete()
&cop->results.reqids,
&cop->results.truncate_seq,
&cop->results.truncate_size,
- &cop->results.extents,
&cop->rval);
op.set_last_op_flags(cop->src_obj_fadvise_flags);
ch.insert(0, obs.oi.size);
ctx->modified_ranges.union_of(ch);
- ctx->delta_stats.num_bytes -= obs.oi.has_extents() ?
- obs.oi.extents.size() : obs.oi.size;
- obs.oi.clear_flag(object_info_t::FLAG_EXTENTS);
- obs.oi.extents.clear();
- obs.oi.size = cb->get_data_size();
- ctx->delta_stats.num_bytes += obs.oi.size;
+ if (cb->get_data_size() != obs.oi.size) {
+ ctx->delta_stats.num_bytes -= obs.oi.size;
+ obs.oi.size = cb->get_data_size();
+ ctx->delta_stats.num_bytes += obs.oi.size;
+ }
ctx->delta_stats.num_wr++;
ctx->delta_stats.num_wr_kb += SHIFT_ROUND_UP(obs.oi.size, 10);
}
tctx->new_obs.oi.truncate_seq = results->truncate_seq;
tctx->new_obs.oi.truncate_size = results->truncate_size;
- if (results->has_extents()) {
- tctx->new_obs.oi.set_flag(object_info_t::FLAG_EXTENTS);
- tctx->new_obs.oi.extents = results->extents;
- }
if (soid.snap != CEPH_NOSNAP) {
assert(obc->ssc->snapset.clone_snaps.count(soid.snap));
tctx->delta_stats.num_bytes += obc->ssc->snapset.get_clone_bytes(soid.snap);
} else {
- tctx->delta_stats.num_bytes += results->has_extents() ?
- results->extents.size() : results->object_size;
+ tctx->delta_stats.num_bytes += results->object_size;
}
}
assert(obc->ssc);
stat.num_bytes += obc->ssc->snapset.get_clone_bytes(oi.soid.snap);
} else {
- stat.num_bytes += oi.has_extents() ?
- oi.extents.size() : oi.size;
+ stat.num_bytes += oi.size;
}
// add it in
ctx->delta_stats.num_objects++;
ctx->delta_stats.num_objects_hit_set_archive++;
- // we do not use extents for usage tracking
- // of hit_set_archive objects, for now!
- assert(!obc->obs.oi.has_extents());
+
ctx->delta_stats.num_bytes += bl.length();
ctx->delta_stats.num_bytes_hit_set_archive += bl.length();
assert(obc);
--ctx->delta_stats.num_objects;
--ctx->delta_stats.num_objects_hit_set_archive;
- assert(!obc->obs.oi.has_extents());
ctx->delta_stats.num_bytes -= obc->obs.oi.size;
ctx->delta_stats.num_bytes_hit_set_archive -= obc->obs.oi.size;
}
// A clone num_bytes will be added later when we have snapset
if (!soid.is_snap()) {
- stat.num_bytes += oi->has_extents() ?
- oi->extents.size() : oi->size;
+ stat.num_bytes += oi->size;
}
if (soid.nspace == cct->_conf->osd_hit_set_namespace)
stat.num_bytes_hit_set_archive += oi->size;
void object_copy_data_t::encode(bufferlist& bl, uint64_t features) const
{
- ENCODE_START(8, 5, bl);
+ ENCODE_START(7, 5, bl);
::encode(size, bl);
::encode(mtime, bl);
::encode(attrs, bl);
::encode(reqids, bl);
::encode(truncate_seq, bl);
::encode(truncate_size, bl);
- ::encode(extents, bl);
ENCODE_FINISH(bl);
}
void object_copy_data_t::decode(bufferlist::iterator& bl)
{
- DECODE_START(8, bl);
+ DECODE_START(7, bl);
if (struct_v < 5) {
// old
::decode(size, bl);
::decode(truncate_seq, bl);
::decode(truncate_size, bl);
}
- if (struct_v >= 8) {
- ::decode(extents, bl);
- }
}
DECODE_FINISH(bl);
}
o.back()->omap_header.append("this is an omap header");
o.back()->snaps.push_back(123);
o.back()->reqids.push_back(make_pair(osd_reqid_t(), version_t()));
- o.back()->extents.insert(0, 123);
}
void object_copy_data_t::dump(Formatter *f) const
user_version = other.user_version;
data_digest = other.data_digest;
omap_digest = other.omap_digest;
- extents = other.extents;
}
void object_info_t::encode(bufferlist& bl, uint64_t features) const
++i) {
old_watchers.insert(make_pair(i->first.second, i->second));
}
- ENCODE_START(18, 8, bl);
+ ENCODE_START(17, 8, bl);
::encode(soid, bl);
::encode(myoloc, bl); //Retained for compatibility
::encode((__u32)0, bl); // was category, no longer used
if (has_manifest()) {
::encode(manifest, bl);
}
- ::encode(extents, bl);
ENCODE_FINISH(bl);
}
void object_info_t::decode(bufferlist::iterator& bl)
{
object_locator_t myoloc;
- DECODE_START_LEGACY_COMPAT_LEN(18, 8, 8, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl);
map<entity_name_t, watch_info_t> old_watchers;
::decode(soid, bl);
::decode(myoloc, bl);
::decode(manifest, bl);
}
}
- if (struct_v >= 18) {
- ::decode(extents, bl);
- }
DECODE_FINISH(bl);
}
f->dump_unsigned("expected_write_size", expected_write_size);
f->dump_unsigned("alloc_hint_flags", alloc_hint_flags);
f->dump_object("manifest", manifest);
- f->open_array_section("extents");
- for (interval_set<uint64_t>::const_iterator p = extents.begin();
- p != extents.end(); ++p) {
- f->open_object_section("extent");
- f->dump_unsigned("offset", p.get_start());
- f->dump_unsigned("length", p.get_len());
- f->close_section();
- }
- f->close_section();
f->open_object_section("watchers");
for (map<pair<uint64_t, entity_name_t>,watch_info_t>::const_iterator p =
watchers.begin(); p != watchers.end(); ++p) {
<< " " << oi.alloc_hint_flags << "]";
if (oi.has_manifest())
out << " " << oi.manifest;
- if (oi.has_extents()) {
- out << " extents " << oi.extents;
- }
out << ")";
return out;
}
mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *out_reqids;
uint64_t *out_truncate_seq;
uint64_t *out_truncate_size;
- interval_set<uint64_t> *out_extents;
int *prval;
C_ObjectOperation_copyget(object_copy_cursor_t *c,
uint64_t *s,
mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *oreqids,
uint64_t *otseq,
uint64_t *otsize,
- interval_set<uint64_t> *otextents,
int *r)
: cursor(c),
out_size(s), out_mtime(m),
out_reqids(oreqids),
out_truncate_seq(otseq),
out_truncate_size(otsize),
- out_extents(otextents),
prval(r) {}
void finish(int r) override {
// reqids are copied on ENOENT
*out_truncate_seq = copy_reply.truncate_seq;
if (out_truncate_size)
*out_truncate_size = copy_reply.truncate_size;
- if (out_extents) {
- *out_extents = copy_reply.extents;
- }
*cursor = copy_reply.cursor;
} catch (buffer::error& e) {
if (prval)
mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *out_reqids,
uint64_t *truncate_seq,
uint64_t *truncate_size,
- interval_set<uint64_t> *extents,
int *prval) {
OSDOp& osd_op = add_op(CEPH_OSD_OP_COPY_GET);
osd_op.op.copy_get.max = max;
out_omap_data, out_snaps, out_snap_seq,
out_flags, out_data_digest,
out_omap_digest, out_reqids, truncate_seq,
- truncate_size, extents, prval);
+ truncate_size, prval);
out_bl[p] = &h->bl;
out_handler[p] = h;
}