]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/alloc_replay_test: be able to cap allocator space with capacity field. 44659/head
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 19 Jan 2022 12:39:04 +0000 (15:39 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Wed, 19 Jan 2022 12:39:04 +0000 (15:39 +0300)
This way one can manually force the tool to use free extents below
the provided capacity only.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/test/objectstore/allocator_replay_test.cc

index 811cc92cdeaf4c1db0b7060c4f528b4ed6264d38..95c0454fcea7ca150e1d5c18be03508c8a546bdd 100644 (file)
@@ -292,7 +292,14 @@ int replay_free_dump_and_apply(char* fname,
     offset = strtol(offset_str.c_str(), &p, 16);
     length = strtol(length_str.c_str(), &p, 16);
 
-    alloc->init_add_free(offset, length);
+    // intentionally skip/trim entries that are above the capacity,
+    // just to be able to "shrink" allocator by editing that field
+    if (offset < capacity) {
+      if (offset + length > capacity) {
+        length = offset + length - capacity;
+      }
+      alloc->init_add_free(offset, length);
+    }
 
     ++it;
   }