}
snap.protection_status = status;
- bufferlist snapshot_bl;
- encode(snap, snapshot_bl);
- r = cls_cxx_map_set_val(hctx, snapshot_key, &snapshot_bl);
+ r = write_key(hctx, snapshot_key, snap, get_encode_features(hctx));
if (r < 0) {
- CLS_ERR("error writing snapshot metadata: %s", cpp_strerror(r).c_str());
return r;
}
flags, mask);
if (snap_id == CEPH_NOSNAP) {
- bufferlist bl;
- encode(flags, bl);
- r = cls_cxx_map_set_val(hctx, "flags", &bl);
+ r = write_key(hctx, "flags", flags);
} else {
snap_meta.flags = flags;
-
- bufferlist bl;
- encode(snap_meta, bl);
- r = cls_cxx_map_set_val(hctx, snap_meta_key, &bl);
+ r = write_key(hctx, snap_meta_key, snap_meta, get_encode_features(hctx));
}
if (r < 0) {
- CLS_ERR("error updating flags: %s", cpp_strerror(r).c_str());
return r;
}
return 0;
std::string snap_key;
key_from_snap_id(snap_meta_copy.id, &snap_key);
- int r = write_key(hctx, snap_key, snap_meta_copy);
+ int r = write_key(hctx, snap_key, snap_meta_copy,
+ get_encode_features(hctx));
if (r < 0) {
return r;
}
}
bufferlist snap_metabl, snap_seqbl;
- encode(snap_meta, snap_metabl);
+ encode(snap_meta, snap_metabl, get_encode_features(hctx));
encode(snap_meta.id, snap_seqbl);
string snapshot_key;
}
snap_meta.name = dst_snap_name;
- bufferlist snap_metabl;
- encode(snap_meta, snap_metabl);
-
- r = cls_cxx_map_set_val(hctx, src_snap_key, &snap_metabl);
+ r = write_key(hctx, src_snap_key, snap_meta, get_encode_features(hctx));
if (r < 0) {
- CLS_ERR("error writing snapshot metadata: %s", cpp_strerror(r).c_str());
return r;
}
uuid_gen.generate_random();
snap.name = uuid_gen.to_string();
- r = write_key(hctx, snapshot_key, snap);
+ r = write_key(hctx, snapshot_key, snap, get_encode_features(hctx));
if (r < 0) {
return r;
}
}
++snap.child_count;
- r = write_key(hctx, snapshot_key, snap);
+ r = write_key(hctx, snapshot_key, snap, get_encode_features(hctx));
if (r < 0) {
CLS_ERR("error writing snapshot: %s", cpp_strerror(r).c_str());
return r;
}
--snap.child_count;
- r = write_key(hctx, snapshot_key, snap);
+ r = write_key(hctx, snapshot_key, snap, get_encode_features(hctx));
if (r < 0) {
CLS_ERR("error writing snapshot: %s", cpp_strerror(r).c_str());
return r;
cls::rbd::SnapshotNamespace snapshot_namespace = {
cls::rbd::UserSnapshotNamespace{}};
uint32_t child_count = 0;
+ std::optional<uint64_t> parent_overlap = std::nullopt;
/// true if we have a parent
bool has_parent() const {
return parent.exists();
}
- void encode(bufferlist& bl) const {
- ENCODE_START(7, 1, bl);
+ void encode(bufferlist& bl, uint64_t features) const {
+ ENCODE_START(8, 1, bl);
encode(id, bl);
encode(name, bl);
encode(image_size, bl);
uint64_t features = 0;
encode(features, bl); // unused -- preserve ABI
- encode(parent, bl, 0);
+ encode(parent, bl, features);
encode(protection_status, bl);
encode(flags, bl);
encode(snapshot_namespace, bl);
encode(timestamp, bl);
encode(child_count, bl);
+ encode(parent_overlap, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator& p) {
if (struct_v >= 7) {
decode(child_count, p);
}
+ if (struct_v >= 8) {
+ decode(parent_overlap, p);
+ }
DECODE_FINISH(p);
}
void dump(Formatter *f) const {
ceph_abort();
}
f->dump_unsigned("child_count", child_count);
+ if (parent_overlap) {
+ f->dump_unsigned("parent_overlap", *parent_overlap);
+ }
}
static void generate_test_instances(list<cls_rbd_snap*>& o) {
o.push_back(new cls_rbd_snap);
o.push_back(t);
}
};
-WRITE_CLASS_ENCODER(cls_rbd_snap)
+WRITE_CLASS_ENCODER_FEATURES(cls_rbd_snap)
#endif // __CEPH_CLS_RBD_H