return features;
}
-uint64_t OSDMap::get_up_osd_features() const
+void OSDMap::_calc_up_osd_features()
{
bool first = true;
- uint64_t features = 0;
+ cached_up_osd_features = 0;
for (int osd = 0; osd < max_osd; ++osd) {
if (!is_up(osd))
continue;
const osd_xinfo_t &xi = get_xinfo(osd);
if (first) {
- features = xi.features;
+ cached_up_osd_features = xi.features;
first = false;
} else {
- features &= xi.features;
+ cached_up_osd_features &= xi.features;
}
}
- return features;
+}
+
+uint64_t OSDMap::get_up_osd_features() const
+{
+ return cached_up_osd_features;
}
void OSDMap::dedup(const OSDMap *o, OSDMap *n)
return -EINVAL;
assert(inc.epoch == epoch+1);
+
epoch++;
modified = inc.modified;
}
calc_num_osds();
+ _calc_up_osd_features();
return 0;
}
}
calc_num_osds();
+ _calc_up_osd_features();
}
void OSDMap::dump_erasure_code_profiles(const map<string,map<string,string> > &profiles,
string cluster_snapshot;
bool new_blacklist_entries;
+ mutable uint64_t cached_up_osd_features;
+
mutable bool crc_defined;
mutable uint32_t crc;
+ void _calc_up_osd_features();
+
public:
bool have_crc() const { return crc_defined; }
uint32_t get_crc() const { return crc; }
osd_uuid(new vector<uuid_d>),
cluster_snapshot_epoch(0),
new_blacklist_entries(false),
+ cached_up_osd_features(0),
crc_defined(false), crc(0),
crush(new CrushWrapper) {
memset(&fsid, 0, sizeof(fsid));