ScrubMap::object &o = i->second;
if (hoid.snap < CEPH_MAXSNAP) {
- // fake nlinks for old primaries
+ // check and if necessary fix snap_mapper
bufferlist bl;
if (o.attrs.find(OI_ATTR) == o.attrs.end()) {
- o.nlinks = 0;
continue;
}
bl.push_back(o.attrs[OI_ATTR]);
try {
oi.decode(bl);
} catch(...) {
- o.nlinks = 0;
continue;
}
- if (oi.snaps.empty()) {
- // Just head
- o.nlinks = 1;
- } else if (oi.snaps.size() == 1) {
- // Just head + only snap
- o.nlinks = 2;
- } else {
- // Just head + 1st and last snaps
- o.nlinks = 3;
- }
-
- // check and if necessary fix snap_mapper
set<snapid_t> oi_snaps(oi.snaps.begin(), oi.snaps.end());
set<snapid_t> cur_snaps;
int r = snap_mapper.get_snaps(hoid, &cur_snaps);
<< dendl;
}
}
- } else {
- o.nlinks = 1;
}
}
}
void ScrubMap::object::encode(bufferlist& bl) const
{
bool compat_read_error = read_error || ec_hash_mismatch || ec_size_mismatch;
- ENCODE_START(8, 2, bl);
+ ENCODE_START(8, 7, bl);
::encode(size, bl);
::encode(negative, bl);
::encode(attrs, bl);
::encode(digest, bl);
::encode(digest_present, bl);
- ::encode(nlinks, bl);
+ ::encode((uint32_t)0, bl); // obsolete nlinks
::encode(snapcolls, bl);
::encode(omap_digest, bl);
::encode(omap_digest_present, bl);
void ScrubMap::object::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(8, 2, 2, bl);
+ DECODE_START(8, bl);
::decode(size, bl);
bool tmp, compat_read_error = false;
::decode(tmp, bl);
negative = tmp;
::decode(attrs, bl);
- if (struct_v >= 3) {
- ::decode(digest, bl);
- ::decode(tmp, bl);
- digest_present = tmp;
- }
- if (struct_v >= 4) {
- ::decode(nlinks, bl);
- ::decode(snapcolls, bl);
- } else {
- /* Indicates that encoder was not aware of this field since stat must
- * return nlink >= 1 */
- nlinks = 0;
- }
- if (struct_v >= 5) {
- ::decode(omap_digest, bl);
- ::decode(tmp, bl);
- omap_digest_present = tmp;
- }
- if (struct_v >= 6) {
- ::decode(compat_read_error, bl);
- }
- if (struct_v >= 7) {
- ::decode(tmp, bl);
- stat_error = tmp;
- }
+ ::decode(digest, bl);
+ ::decode(tmp, bl);
+ digest_present = tmp;
+ uint32_t nlinks;
+ ::decode(nlinks, bl);
+ ::decode(snapcolls, bl);
+ ::decode(omap_digest, bl);
+ ::decode(tmp, bl);
+ omap_digest_present = tmp;
+ ::decode(compat_read_error, bl);
+ ::decode(tmp, bl);
+ stat_error = tmp;
if (struct_v >= 8) {
::decode(tmp, bl);
read_error = tmp;
uint64_t size;
__u32 omap_digest; ///< omap crc32c
__u32 digest; ///< data crc32c
- uint32_t nlinks;
bool negative:1;
bool digest_present:1;
bool omap_digest_present:1;
object() :
// Init invalid size so it won't match if we get a stat EIO error
- size(-1), omap_digest(0), digest(0), nlinks(0),
+ size(-1), omap_digest(0), digest(0),
negative(false), digest_present(false), omap_digest_present(false),
read_error(false), stat_error(false), ec_hash_mismatch(false), ec_size_mismatch(false) {}