Skip to content

Commit 0a17afe

Browse files
committed
osd/scrub: remove unnecessary loop
Signed-off-by: Ronen Friedman <[email protected]>
1 parent ae82b04 commit 0a17afe

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

src/osd/scrubber/scrub_backend.cc

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -230,37 +230,30 @@ void ScrubBackend::omap_checks()
230230
}
231231

232232
stringstream wss;
233+
const auto& smap = this_chunk->received_maps.at(m_pg_whoami);
233234

234235
// Iterate through objects and update omap stats
235236
for (const auto& ho : this_chunk->authoritative_set) {
236237

237-
for (const auto& [srd, smap] : this_chunk->received_maps) {
238-
if (srd != m_pg_whoami) {
239-
// Only set omap stats for the primary
240-
continue;
241-
}
242-
243-
auto it = smap.objects.find(ho);
244-
if (it == smap.objects.end()) {
245-
continue;
246-
}
238+
const auto it = smap.objects.find(ho);
239+
if (it == smap.objects.end()) {
240+
continue;
241+
}
247242

248-
const ScrubMap::object& smap_obj = it->second;
249-
m_omap_stats.omap_bytes += smap_obj.object_omap_bytes;
250-
m_omap_stats.omap_keys += smap_obj.object_omap_keys;
251-
if (smap_obj.large_omap_object_found) {
252-
auto osdmap = m_scrubber.get_osdmap();
253-
pg_t pg;
254-
osdmap->map_to_pg(ho.pool, ho.oid.name, ho.get_key(), ho.nspace, &pg);
255-
pg_t mpg = osdmap->raw_pg_to_pg(pg);
256-
m_omap_stats.large_omap_objects++;
257-
wss << "Large omap object found. Object: " << ho << " PG: " << pg
258-
<< " (" << mpg << ")"
259-
<< " Key count: " << smap_obj.large_omap_object_key_count
260-
<< " Size (bytes): " << smap_obj.large_omap_object_value_size
261-
<< '\n';
262-
break;
263-
}
243+
const ScrubMap::object& smap_obj = it->second;
244+
m_omap_stats.omap_bytes += smap_obj.object_omap_bytes;
245+
m_omap_stats.omap_keys += smap_obj.object_omap_keys;
246+
if (smap_obj.large_omap_object_found) {
247+
auto osdmap = m_scrubber.get_osdmap();
248+
pg_t pg;
249+
osdmap->map_to_pg(ho.pool, ho.oid.name, ho.get_key(), ho.nspace, &pg);
250+
pg_t mpg = osdmap->raw_pg_to_pg(pg);
251+
m_omap_stats.large_omap_objects++;
252+
wss << "Large omap object found. Object: " << ho << " PG: " << pg << " ("
253+
<< mpg << ")"
254+
<< " Key count: " << smap_obj.large_omap_object_key_count
255+
<< " Size (bytes): " << smap_obj.large_omap_object_value_size << '\n';
256+
break;
264257
}
265258
}
266259

0 commit comments

Comments
 (0)