// ---------------------
// PGMap
-void PGMap::Incremental::encode(bufferlist &bl, uint64_t features) const
-{
- if ((features & CEPH_FEATURE_MONENC) == 0) {
- __u8 v = 4;
- ::encode(v, bl);
- ::encode(version, bl);
- ::encode(pg_stat_updates, bl);
- ::encode(osd_stat_updates, bl);
- ::encode(osd_stat_rm, bl);
- ::encode(osdmap_epoch, bl);
- ::encode(pg_scan, bl);
- ::encode((float).95, bl);
- ::encode((float).85, bl);
- ::encode(pg_remove, bl);
- return;
- }
-
- ENCODE_START(7, 5, bl);
- ::encode(version, bl);
- ::encode(pg_stat_updates, bl);
- ::encode(osd_stat_updates, bl);
- ::encode(osd_stat_rm, bl);
- ::encode(osdmap_epoch, bl);
- ::encode(pg_scan, bl);
- ::encode((float).95, bl); // full_ratio
- ::encode((float).85, bl); // nearfull_ratio
- ::encode(pg_remove, bl);
- ::encode(stamp, bl);
- {
- map<int32_t,epoch_t> osd_epochs;
- ::encode(osd_epochs, bl);
- }
- ENCODE_FINISH(bl);
-}
-
-void PGMap::Incremental::decode(bufferlist::iterator &bl)
-{
- DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl);
- ::decode(version, bl);
- if (struct_v < 3) {
- pg_stat_updates.clear();
- __u32 n;
- ::decode(n, bl);
- while (n--) {
- old_pg_t opgid;
- ::decode(opgid, bl);
- pg_t pgid = opgid;
- ::decode(pg_stat_updates[pgid], bl);
- }
- } else {
- ::decode(pg_stat_updates, bl);
- }
- ::decode(osd_stat_updates, bl);
- ::decode(osd_stat_rm, bl);
- ::decode(osdmap_epoch, bl);
- ::decode(pg_scan, bl);
- float full_ratio;
- ::decode(full_ratio, bl);
- ::decode(full_ratio, bl); // nearfull
- if (struct_v < 3) {
- pg_remove.clear();
- __u32 n;
- ::decode(n, bl);
- while (n--) {
- old_pg_t opgid;
- ::decode(opgid, bl);
- pg_remove.insert(pg_t(opgid));
- }
- } else {
- ::decode(pg_remove, bl);
- }
- if (struct_v >= 6)
- ::decode(stamp, bl);
- if (struct_v >= 7) {
- map<int32_t,epoch_t> osd_epochs;
- ::decode(osd_epochs, bl);
- }
- DECODE_FINISH(bl);
-}
-
void PGMap::Incremental::dump(Formatter *f) const
{
f->dump_unsigned("version", version);
osd_stat_rm.insert(osd);
osd_stat_updates.erase(osd);
}
- void encode(bufferlist &bl, uint64_t features=-1) const;
- void decode(bufferlist::iterator &bl);
void dump(Formatter *f) const;
static void generate_test_instances(list<Incremental*>& o);
static void generate_test_instances(list<PGMap*>& o);
};
-WRITE_CLASS_ENCODER_FEATURES(PGMap::Incremental)
WRITE_CLASS_ENCODER_FEATURES(PGMap)
inline ostream& operator<<(ostream& out, const PGMapDigest& m) {