From: Ilya Dryomov Date: Wed, 20 Dec 2023 11:22:17 +0000 (+0100) Subject: librbd/object_map: drop bogus if in handle_load_object_map() X-Git-Tag: v16.2.15~27^2~16 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=19031529c50141380027046584e5dce334e8bedf;p=ceph.git librbd/object_map: drop bogus if in handle_load_object_map() It became redundant with commit b81cd2460de7 ("librbd/object_map: diff state machine should track object existence") -- it != end_it condition in the loop is sufficient. Signed-off-by: Ilya Dryomov (cherry picked from commit 4e036d65b9146f28a2f6c0dfb353120baea8d62d) --- diff --git a/src/librbd/object_map/DiffRequest.cc b/src/librbd/object_map/DiffRequest.cc index 633ac874e55c7..b762406115c8f 100644 --- a/src/librbd/object_map/DiffRequest.cc +++ b/src/librbd/object_map/DiffRequest.cc @@ -235,48 +235,46 @@ void DiffRequest::handle_load_object_map(int r) { bool diff_from_start = (m_snap_id_start == 0); auto end_it = m_object_map.end(); - if (m_object_map.size() > prev_object_diff_state_size) { - for (; it != end_it; ++it,++diff_it, ++i) { - uint8_t object_map_state = *it; - if (object_map_state == OBJECT_NONEXISTENT) { - *diff_it = DIFF_STATE_HOLE; - } else if (diff_from_start || - (m_object_diff_state_valid && - object_map_state != OBJECT_EXISTS_CLEAN)) { - // diffing against the beginning of time or image was grown - // (implicit) starting state is HOLE, this is the first object - // map after - if (m_diff_iterate_range) { - // for diff-iterate, if the object is discarded prior to or - // in the end version, result should be HOLE - // since DATA_UPDATED can transition only to HOLE_UPDATED, - // stay in HOLE on intermediate snapshots -- another way to - // put this is that when starting with a hole, intermediate - // snapshots can be ignored as the result depends only on the - // end version - if (m_current_snap_id == m_snap_id_end) { - *diff_it = DIFF_STATE_DATA_UPDATED; - } else { - *diff_it = DIFF_STATE_HOLE; - } - } else { - // for deep-copy, if the object is discarded prior to or - // in the end version, result should be HOLE_UPDATED + for (; it != end_it; ++it, ++diff_it, ++i) { + uint8_t object_map_state = *it; + if (object_map_state == OBJECT_NONEXISTENT) { + *diff_it = DIFF_STATE_HOLE; + } else if (diff_from_start || + (m_object_diff_state_valid && + object_map_state != OBJECT_EXISTS_CLEAN)) { + // diffing against the beginning of time or image was grown + // (implicit) starting state is HOLE, this is the first object + // map after + if (m_diff_iterate_range) { + // for diff-iterate, if the object is discarded prior to or + // in the end version, result should be HOLE + // since DATA_UPDATED can transition only to HOLE_UPDATED, + // stay in HOLE on intermediate snapshots -- another way to + // put this is that when starting with a hole, intermediate + // snapshots can be ignored as the result depends only on the + // end version + if (m_current_snap_id == m_snap_id_end) { *diff_it = DIFF_STATE_DATA_UPDATED; - } - } else { - // diffing against a snapshot, this is its object map - if (object_map_state != OBJECT_PENDING) { - *diff_it = DIFF_STATE_DATA; } else { - *diff_it = DIFF_STATE_DATA_UPDATED; + *diff_it = DIFF_STATE_HOLE; } + } else { + // for deep-copy, if the object is discarded prior to or + // in the end version, result should be HOLE_UPDATED + *diff_it = DIFF_STATE_DATA_UPDATED; + } + } else { + // diffing against a snapshot, this is its object map + if (object_map_state != OBJECT_PENDING) { + *diff_it = DIFF_STATE_DATA; + } else { + *diff_it = DIFF_STATE_DATA_UPDATED; } - - ldout(cct, 20) << "object state: " << i << " " - << "->" << static_cast(*diff_it) << " (" - << static_cast(*it) << ")" << dendl; } + + ldout(cct, 20) << "object state: " << i << " " + << "->" << static_cast(*diff_it) << " (" + << static_cast(*it) << ")" << dendl; } ldout(cct, 20) << "computed resize diffs" << dendl;