Skip to content

Commit

Permalink
osd/OSDMap: get_up_osd_features()
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Sage Weil authored and Yan, Zheng committed Jan 10, 2014
1 parent b8dfcc1 commit 1d8429d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/osd/OSDMap.cc
Expand Up @@ -829,6 +829,24 @@ uint64_t OSDMap::get_features(uint64_t *pmask) const
return features;
}

uint64_t OSDMap::get_up_osd_features() const
{
bool first = true;
uint64_t 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;
first = false;
} else {
features &= xi.features;
}
}
return features;
}

void OSDMap::dedup(const OSDMap *o, OSDMap *n)
{
if (o->epoch == n->epoch)
Expand Down
5 changes: 5 additions & 0 deletions src/osd/OSDMap.h
Expand Up @@ -450,6 +450,11 @@ class OSDMap {
*/
uint64_t get_features(uint64_t *mask) const;

/**
* get intersection of features supported by up osds
*/
uint64_t get_up_osd_features() const;

int apply_incremental(const Incremental &inc);

/// try to re-use/reference addrs in oldmap from newmap
Expand Down

0 comments on commit 1d8429d

Please sign in to comment.