]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: optionally exclude any zeroed extents from object list-snaps
authorJason Dillaman <dillaman@redhat.com>
Wed, 9 Sep 2020 16:16:30 +0000 (12:16 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 21 Sep 2020 11:51:56 +0000 (07:51 -0400)
When listing parent snapshots we only care about data extents and not
about zeroed or missing extents.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/io/ObjectRequest.cc
src/librbd/io/Types.h

index bdb724535a9bebc067390f401b3fe3d51182857d..d29489e6226efbf86d79d100d1f34b99202bbbba 100644 (file)
@@ -922,7 +922,9 @@ void ObjectListSnapsRequest<I>::handle_list_snaps(int r) {
         }
 
         zero_interval.intersection_of(object_interval);
-        if (!zero_interval.empty()) {
+        if (!zero_interval.empty() &&
+            ((m_list_snaps_flags &
+                LIST_SNAPS_FLAG_IGNORE_ZEROED_EXTENTS) == 0)) {
           ldout(cct, 20) << "object_extent=" << object_extent.first << "~"
                          << object_extent.second << " "
                          << "zero_interval=" << zero_interval << dendl;
@@ -1003,9 +1005,13 @@ void ObjectListSnapsRequest<I>::list_from_parent() {
   ldout(cct, 20) << "aio_comp=" << aio_comp<< ", "
                  << "parent_image_extents " << parent_image_extents << dendl;
 
+   auto list_snaps_flags = (
+     m_list_snaps_flags | LIST_SNAPS_FLAG_IGNORE_ZEROED_EXTENTS);
+
   ImageListSnapsRequest<I> req(
     *image_ctx->parent, aio_comp, std::move(parent_image_extents), {0,
-    image_ctx->parent->snap_id}, 0, &m_parent_snapshot_delta, this->m_trace);
+    image_ctx->parent->snap_id}, list_snaps_flags, &m_parent_snapshot_delta,
+    this->m_trace);
   req.send();
 }
 
@@ -1059,7 +1065,8 @@ void ObjectListSnapsRequest<I>::zero_initial_extent(bool dne) {
   librados::snap_t snap_id_start = *m_snap_ids.begin();
 
   // the object does not exist -- mark the missing extents
-  if (snap_id_start == 0) {
+  if ((snap_id_start == 0) &&
+       ((m_list_snaps_flags & LIST_SNAPS_FLAG_IGNORE_ZEROED_EXTENTS) == 0)) {
     for (auto [object_offset, object_length] : m_object_extents) {
       ldout(cct, 20) << "zeroing initial extent " << object_offset << "~"
                      << object_length << dendl;
index bce9fd22762e4d6f60aca319566fbbd154dd1cb6..663cd2399dea1267a34265cb4d1c7dea6bf8448f 100644 (file)
@@ -127,6 +127,7 @@ enum {
 enum {
   LIST_SNAPS_FLAG_DISABLE_LIST_FROM_PARENT      = 1UL << 0,
   LIST_SNAPS_FLAG_WHOLE_OBJECT                  = 1UL << 1,
+  LIST_SNAPS_FLAG_IGNORE_ZEROED_EXTENTS         = 1UL << 2,
 };
 
 enum SnapshotExtentState {