From: David Zafman Date: Wed, 14 Mar 2018 16:50:06 +0000 (-0700) Subject: osd: Changes to handle sharding for EC in missing_by_count X-Git-Tag: v13.1.0~565^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1e9853398498c6a3708abcccac7194f015be49d9;p=ceph.git osd: Changes to handle sharding for EC in missing_by_count Signed-off-by: David Zafman --- diff --git a/src/osd/PG.h b/src/osd/PG.h index ca89dcff038..a89eb3004d9 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -649,16 +649,38 @@ protected: // for every entry in missing_loc, we count how many of each type of shard we have, // and maintain totals here. The sum of the values for this map will always equal // missing_loc.size(). - map missing_by_count; + map < shard_id_t, map > missing_by_count; + + void pgs_by_shard_id(const set& s, map< shard_id_t, set >& pgsbs) { + if (pg->get_osdmap()->pg_is_ec(pg->info.pgid.pgid)) { + int num_shards = pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid); + // For completely missing shards initialize with empty set + for (int i = 0 ; i < num_shards ; ++i) { + shard_id_t shard(i); + pgsbs[shard]; + } + for (auto pgs: s) + pgsbs[pgs.shard].insert(pgs); + } else { + pgsbs[shard_id_t::NO_SHARD] = s; + } + } void _inc_count(const set& s) { - ++missing_by_count[_get_count(s)]; + map< shard_id_t, set > pgsbs; + pgs_by_shard_id(s, pgsbs); + for (auto shard: pgsbs) + ++missing_by_count[shard.first][_get_count(shard.second)]; } void _dec_count(const set& s) { - auto p = missing_by_count.find(_get_count(s)); - assert(p != missing_by_count.end()); - if (--p->second == 0) { - missing_by_count.erase(p); + map< shard_id_t, set > pgsbs; + pgs_by_shard_id(s, pgsbs); + for (auto shard: pgsbs) { + auto p = missing_by_count[shard.first].find(_get_count(shard.second)); + assert(p != missing_by_count[shard.first].end()); + if (--p->second == 0) { + missing_by_count[shard.first].erase(p); + } } } @@ -874,7 +896,7 @@ protected: const map &get_needs_recovery() const { return needs_recovery_map; } - const map &get_missing_by_count() const { + const map < shard_id_t, map > &get_missing_by_count() const { return missing_by_count; } } missing_loc;