From: Samuel Just Date: Thu, 9 Jul 2020 01:38:15 +0000 (-0700) Subject: osd_types: clarify comments in calc_refs_to_drop_on_removal X-Git-Tag: v16.1.0~1738^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94b57f0ca9f853f8ac520c0edb1a210b0b367f89;p=ceph.git osd_types: clarify comments in calc_refs_to_drop_on_removal Signed-off-by: Samuel Just --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 55e6e154c93b2..bfc84d94e7edd 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -5883,15 +5883,20 @@ void object_manifest_t::calc_refs_to_drop_on_removal( std::numeric_limits::max() : i->first; }; - // Translate current, iter, map to a chunk_info_t, nullopt_t if iter - // is ahead of current or is at end() + /* If current matches the offset at iter, returns the chunk at *iter + * and increments iter. Otherwise, returns nullptr. + * + * current will always be derived from the min of *giter, *iter, and + * *liter on each cycle, so the result will be that each loop iteration + * will pick up all chunks at the offest being considered, each offset + * will be considered once, and all offsets will be considered. + */ auto get_chunk = []( uint64_t current, decltype(iter) &i, const object_manifest_t &manifest) -> const chunk_info_t * { if (i == manifest.chunk_map.end() || current != i->first) { return nullptr; } else { - // We advance the iterator iff we consider the chunk_map on this iteration return &(i++)->second; } };