From: Zac Medico Date: Thu, 24 Aug 2017 16:40:45 +0000 (-0700) Subject: PGPool::update: avoid expensive union_of X-Git-Tag: v13.0.1~1141^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bf20b661cb6a6a33d9e93fb44ad1470f9f8245d2;p=ceph.git PGPool::update: avoid expensive union_of Achieve the same result using a swap (constant complexity), and an assignment (linear complexity). Signed-off-by: Zac Medico --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3f51b1eb2631..3e671de9b092 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -241,8 +241,9 @@ void PGPool::update(OSDMapRef map) interval_set intersection; intersection.intersection_of(newly_removed_snaps, cached_removed_snaps); if (intersection == cached_removed_snaps) { - newly_removed_snaps.subtract(cached_removed_snaps); - cached_removed_snaps.union_of(newly_removed_snaps); + cached_removed_snaps.swap(newly_removed_snaps); + newly_removed_snaps = cached_removed_snaps; + newly_removed_snaps.subtract(intersection); } else { lgeneric_subdout(cct, osd, 0) << __func__ << " cached_removed_snaps shrank from " << cached_removed_snaps