| 29 | } |
| 30 | |
| 31 | void CompatSet::FeatureSet::decode(ceph::buffer::list::const_iterator& bl) { |
| 32 | using ceph::decode; |
| 33 | decode(mask, bl); |
| 34 | decode(names, bl); |
| 35 | /** |
| 36 | * Previously, there was a bug where insert did |
| 37 | * mask |= f.id rather than mask |= (1 << f.id). |
| 38 | * In FeatureSets from those version, mask always |
| 39 | * has the lowest bit set. Since then, masks always |
| 40 | * have the lowest bit unset. |
| 41 | * |
| 42 | * When we encounter such a FeatureSet, we have to |
| 43 | * reconstruct the mask from the names map. |
| 44 | */ |
| 45 | if (mask & 1) { |
| 46 | mask = 1; |
| 47 | std::map<uint64_t, std::string> temp_names; |
| 48 | temp_names.swap(names); |
| 49 | for (auto i = temp_names.begin(); i != temp_names.end(); ++i) { |
| 50 | insert(Feature(i->first, i->second)); |
| 51 | } |
| 52 | } else { |
| 53 | mask |= 1; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | void CompatSet::FeatureSet::dump(ceph::Formatter *f) const { |
| 58 | for (auto p = names.cbegin(); p != names.cend(); ++p) { |