osd: speed up upmap underfull fallback
According to our tests, this commit can speed up pg upmap calculations by orders of magnitude Performance analysis: Suppose: R = number of pg_upmap_items (the full candidate pool, after to_skip/only_pools filtering) M = how many OSDs the deviation_osd loop visits before it breaks (less or equal to underfull count) U = the number of distinct from OSDs in the upmap items. U is less or equal to number of OSDs, and should be less than R x k k = mapping pairs per candidate (usually 1, small) Time complexity of OSDMap::calc_pg_upmaps(): Before the commit: O(M * R) After the commit: O(R * k + M * log(U)) ~= O(R + M *log(U)) Performant evaluation: Existing upmap items Underfull OSDs Old path New path Speedup 50000 1000 6.51s 0.047s 137x 100000 1000 12.05s 0.086s 140x 200000 2000 63.93s 0.281s 227x Fixes: https://tracker.ceph.com/issues/77563 Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com> Assisted-by: Codex:GPT-5.5
X
Xuehan Xu committed
cfd916b1b4190c1d961efcc700feba9164e9dd87
Parent: b51d3cd
Committed by Xuehan Xu <xuxuehan@qianxin.com>
on 6/24/2026, 7:48:16 AM