]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/object_map: drop bogus if in handle_load_object_map()
authorIlya Dryomov <idryomov@gmail.com>
Wed, 20 Dec 2023 11:22:17 +0000 (12:22 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sat, 20 Jan 2024 15:33:32 +0000 (16:33 +0100)
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 <idryomov@gmail.com>
(cherry picked from commit 4e036d65b9146f28a2f6c0dfb353120baea8d62d)

src/librbd/object_map/DiffRequest.cc

index 633ac874e55c701160cc5974087ec9e30996732a..b762406115c8fa7de4b16d4329abfb23197e6745 100644 (file)
@@ -235,48 +235,46 @@ void DiffRequest<I>::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<uint32_t>(*diff_it) << " ("
-                     << static_cast<uint32_t>(*it) << ")" << dendl;
     }
+
+    ldout(cct, 20) << "object state: " << i << " "
+                   << "->" << static_cast<uint32_t>(*diff_it) << " ("
+                   << static_cast<uint32_t>(*it) << ")" << dendl;
   }
   ldout(cct, 20) << "computed resize diffs" << dendl;