t->touch(coll, ghobject_t(target_oid));
t->truncate(coll, ghobject_t(target_oid), recovery_info.size);
t->omap_setheader(coll, ghobject_t(target_oid), omap_header);
+
+ bufferlist bv = attrs[OI_ATTR];
+ object_info_t oi(bv);
+ t->set_alloc_hint(coll, ghobject_t(target_oid),
+ oi.expected_object_size,
+ oi.expected_write_size);
}
uint64_t off = 0;
uint32_t fadvise_flags = CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL;
++i) {
old_watchers.insert(make_pair(i->first.second, i->second));
}
- ENCODE_START(15, 8, bl);
+ ENCODE_START(16, 8, bl);
::encode(soid, bl);
::encode(myoloc, bl); //Retained for compatibility
::encode((__u32)0, bl); // was category, no longer used
::encode(local_mtime, bl);
::encode(data_digest, bl);
::encode(omap_digest, bl);
+ ::encode(expected_object_size, bl);
+ ::encode(expected_write_size, bl);
ENCODE_FINISH(bl);
}
void object_info_t::decode(bufferlist::iterator& bl)
{
object_locator_t myoloc;
- DECODE_START_LEGACY_COMPAT_LEN(15, 8, 8, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(16, 8, 8, bl);
map<entity_name_t, watch_info_t> old_watchers;
::decode(soid, bl);
::decode(myoloc, bl);
clear_flag(FLAG_DATA_DIGEST);
clear_flag(FLAG_OMAP_DIGEST);
}
+ if (struct_v >= 16) {
+ ::decode(expected_object_size, bl);
+ ::decode(expected_write_size, bl);
+ } else {
+ expected_object_size = 0;
+ expected_write_size = 0;
+ }
DECODE_FINISH(bl);
}
f->dump_unsigned("truncate_size", truncate_size);
f->dump_unsigned("data_digest", data_digest);
f->dump_unsigned("omap_digest", omap_digest);
+ f->dump_unsigned("expected_object_size", expected_object_size);
+ f->dump_unsigned("expected_write_size", expected_write_size);
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) {
out << " dd " << std::hex << oi.data_digest << std::dec;
if (oi.is_omap_digest())
out << " od " << std::hex << oi.omap_digest << std::dec;
+ out << " alloc_hint [" << oi.expected_object_size
+ << " " << oi.expected_write_size << "]";
out << ")";
return out;
// opportunistic checksums; may or may not be present
__u32 data_digest; ///< data crc32c
__u32 omap_digest; ///< omap crc32c
+
+ // alloc hint attribute
+ uint64_t expected_object_size, expected_write_size;
+ uint32_t alloc_hint_flags;
void copy_user_bits(const object_info_t& other);
explicit object_info_t()
: user_version(0), size(0), flags((flag_t)0),
truncate_seq(0), truncate_size(0),
- data_digest(-1), omap_digest(-1)
+ data_digest(-1), omap_digest(-1),
+ expected_object_size(0), expected_write_size(0),
+ alloc_hint_flags(0)
{}
explicit object_info_t(const hobject_t& s)
: soid(s),
user_version(0), size(0), flags((flag_t)0),
truncate_seq(0), truncate_size(0),
- data_digest(-1), omap_digest(-1)
+ data_digest(-1), omap_digest(-1),
+ expected_object_size(0), expected_write_size(0),
+ alloc_hint_flags(0)
{}
explicit object_info_t(bufferlist& bl) {