diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2022-10-17 15:51:04 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2022-12-04 18:19:19 +0100 |
commit | 15c248243fb8c1319782db407cdffb7c01122225 (patch) | |
tree | 70837c32edc4b8b6a5fc35499c1fb464f2a043b3 /src/test/librbd/operation/test_mock_TrimRequest.cc | |
parent | librbd: reduce overlap and respect area when pruning parent extents (diff) | |
download | ceph-15c248243fb8c1319782db407cdffb7c01122225.tar.xz ceph-15c248243fb8c1319782db407cdffb7c01122225.zip |
librbd: non-pruning parent overlap handling fixes
Apply similar "reduce overlap and respect area" logic to places
that don't use prune_parent_extents(). Changes to FlattenRequest
and TrimRequest here should complete the long tail of encrypted
I/O path and flatten fixes.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'src/test/librbd/operation/test_mock_TrimRequest.cc')
-rw-r--r-- | src/test/librbd/operation/test_mock_TrimRequest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/librbd/operation/test_mock_TrimRequest.cc b/src/test/librbd/operation/test_mock_TrimRequest.cc index cd18f1306e9..1771e741377 100644 --- a/src/test/librbd/operation/test_mock_TrimRequest.cc +++ b/src/test/librbd/operation/test_mock_TrimRequest.cc @@ -156,6 +156,17 @@ public: }))); } + void expect_reduce_parent_overlap(MockTestImageCtx& mock_image_ctx, + uint64_t overlap) { + EXPECT_CALL(mock_image_ctx, reduce_parent_overlap(overlap, false)) + .WillOnce(Return(std::make_pair(overlap, io::ImageArea::DATA))); + } + + void expect_get_area_size(MockTestImageCtx& mock_image_ctx) { + EXPECT_CALL(mock_image_ctx, get_area_size(io::ImageArea::CRYPTO_HEADER)) + .WillOnce(Return(0)); + } + void expect_object_may_exist(MockTestImageCtx &mock_image_ctx, uint64_t object_no, bool exists) { if (mock_image_ctx.object_map != nullptr) { @@ -221,7 +232,9 @@ TEST_F(TestMockOperationTrimRequest, SuccessRemove) { true, 0); // copy-up + expect_get_area_size(mock_image_ctx); expect_get_parent_overlap(mock_image_ctx, 0); + expect_reduce_parent_overlap(mock_image_ctx, 0); // remove expect_object_may_exist(mock_image_ctx, 0, true); @@ -277,7 +290,9 @@ TEST_F(TestMockOperationTrimRequest, SuccessCopyUp) { // copy-up io::MockObjectDispatch mock_io_object_dispatch; + expect_get_area_size(mock_image_ctx); expect_get_parent_overlap(mock_image_ctx, ictx->get_object_size()); + expect_reduce_parent_overlap(mock_image_ctx, ictx->get_object_size()); expect_get_object_name(mock_image_ctx, 0, "object0"); expect_object_discard(mock_image_ctx, mock_io_object_dispatch, 0, ictx->get_object_size(), false, 0); @@ -369,7 +384,9 @@ TEST_F(TestMockOperationTrimRequest, RemoveError) { false, 0); // copy-up + expect_get_area_size(mock_image_ctx); expect_get_parent_overlap(mock_image_ctx, 0); + expect_reduce_parent_overlap(mock_image_ctx, 0); // remove expect_object_may_exist(mock_image_ctx, 0, true); @@ -421,7 +438,9 @@ TEST_F(TestMockOperationTrimRequest, CopyUpError) { // copy-up io::MockObjectDispatch mock_io_object_dispatch; + expect_get_area_size(mock_image_ctx); expect_get_parent_overlap(mock_image_ctx, ictx->get_object_size()); + expect_reduce_parent_overlap(mock_image_ctx, ictx->get_object_size()); expect_get_object_name(mock_image_ctx, 0, "object0"); expect_object_discard(mock_image_ctx, mock_io_object_dispatch, 0, ictx->get_object_size(), false, -EINVAL); |