From: Igor Fedotov Date: Wed, 19 Jan 2022 12:39:04 +0000 (+0300) Subject: test/alloc_replay_test: be able to cap allocator space with capacity field. X-Git-Tag: v18.0.0~1376^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=75fcc062d9c850fb63d2d024b9307f78303cb7d2;p=ceph.git test/alloc_replay_test: be able to cap allocator space with capacity field. This way one can manually force the tool to use free extents below the provided capacity only. Signed-off-by: Igor Fedotov --- diff --git a/src/test/objectstore/allocator_replay_test.cc b/src/test/objectstore/allocator_replay_test.cc index 811cc92cdea..95c0454fcea 100644 --- a/src/test/objectstore/allocator_replay_test.cc +++ b/src/test/objectstore/allocator_replay_test.cc @@ -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; }