diff options
author | Jason Dillaman <dillaman@redhat.com> | 2020-05-06 01:35:58 +0200 |
---|---|---|
committer | Jason Dillaman <dillaman@redhat.com> | 2020-05-14 17:56:45 +0200 |
commit | 5687d923e318d05c0006ac99789716dfcd99ee6e (patch) | |
tree | 21580bab54e6dfacb0a5ab545e2d419ebf5c6767 /src/test/librbd | |
parent | librbd: complete ImageDispatchSpec upon AioCompletion finalization (diff) | |
download | ceph-5687d923e318d05c0006ac99789716dfcd99ee6e.tar.xz ceph-5687d923e318d05c0006ac99789716dfcd99ee6e.zip |
librbd: temporarily redirect ImageRequestWQ IO through ImageDispatcher
The next series of commits will work to remove ImageRequestWQ from librbd.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test/librbd')
-rw-r--r-- | src/test/librbd/io/test_mock_ImageRequestWQ.cc | 50 | ||||
-rw-r--r-- | src/test/librbd/journal/test_Replay.cc | 1 | ||||
-rw-r--r-- | src/test/librbd/operation/test_mock_ResizeRequest.cc | 20 |
3 files changed, 35 insertions, 36 deletions
diff --git a/src/test/librbd/io/test_mock_ImageRequestWQ.cc b/src/test/librbd/io/test_mock_ImageRequestWQ.cc index 61929e0f84d..b3e24ff50cf 100644 --- a/src/test/librbd/io/test_mock_ImageRequestWQ.cc +++ b/src/test/librbd/io/test_mock_ImageRequestWQ.cc @@ -180,8 +180,8 @@ struct TestMockIoImageRequestWQ : public TestMockFixture { } void expect_front(MockImageRequestWQ &image_request_wq, - MockImageDispatchSpec *image_request) { - EXPECT_CALL(image_request_wq, front()).WillOnce(Return(image_request)); + MockImageDispatchSpec& image_request) { + EXPECT_CALL(image_request_wq, front()).WillOnce(Return(&image_request)); } void expect_is_refresh_request(MockTestImageCtx &mock_image_ctx, @@ -191,8 +191,8 @@ struct TestMockIoImageRequestWQ : public TestMockFixture { } void expect_dequeue(MockImageRequestWQ &image_request_wq, - MockImageDispatchSpec *image_request) { - EXPECT_CALL(image_request_wq, dequeue()).WillOnce(Return(image_request)); + MockImageDispatchSpec &image_request) { + EXPECT_CALL(image_request_wq, dequeue()).WillOnce(Return(&image_request)); } void expect_get_exclusive_lock_policy(MockTestImageCtx &mock_image_ctx, @@ -257,16 +257,16 @@ TEST_F(TestMockIoImageRequestWQ, AcquireLockError) { MockExclusiveLock mock_exclusive_lock; mock_image_ctx.exclusive_lock = &mock_exclusive_lock; - auto mock_queued_image_request = new MockImageDispatchSpec(); - expect_get_image_extents(*mock_queued_image_request, {}); - expect_get_tid(*mock_queued_image_request, 0); + MockImageDispatchSpec mock_queued_image_request; + expect_get_image_extents(mock_queued_image_request, {}); + expect_get_tid(mock_queued_image_request, 0); InSequence seq; MockImageRequestWQ mock_image_request_wq(&mock_image_ctx, "io", 60, nullptr); expect_signal(mock_image_request_wq); mock_image_request_wq.set_require_lock(DIRECTION_WRITE, true); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_queue(mock_image_request_wq); auto *aio_comp = new librbd::io::AioCompletion(); mock_image_request_wq.aio_write(aio_comp, 0, 0, {}, 0); @@ -274,7 +274,7 @@ TEST_F(TestMockIoImageRequestWQ, AcquireLockError) { librbd::exclusive_lock::MockPolicy mock_exclusive_lock_policy; expect_front(mock_image_request_wq, mock_queued_image_request); expect_is_refresh_request(mock_image_ctx, false); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_dequeue(mock_image_request_wq, mock_queued_image_request); expect_get_exclusive_lock_policy(mock_image_ctx, mock_exclusive_lock_policy); expect_may_auto_request_lock(mock_exclusive_lock_policy, true); @@ -284,8 +284,8 @@ TEST_F(TestMockIoImageRequestWQ, AcquireLockError) { ASSERT_TRUE(on_acquire != nullptr); expect_process_finish(mock_image_request_wq); - expect_fail(*mock_queued_image_request, -EPERM); - expect_is_write_op(*mock_queued_image_request, true); + expect_fail(mock_queued_image_request, -EPERM); + expect_is_write_op(mock_queued_image_request, true); expect_signal(mock_image_request_wq); on_acquire->complete(-EPERM); @@ -304,16 +304,16 @@ TEST_F(TestMockIoImageRequestWQ, AcquireLockBlacklisted) { MockExclusiveLock mock_exclusive_lock; mock_image_ctx.exclusive_lock = &mock_exclusive_lock; - auto mock_queued_image_request = new MockImageDispatchSpec(); - expect_get_image_extents(*mock_queued_image_request, {}); - expect_get_tid(*mock_queued_image_request, 0); + MockImageDispatchSpec mock_queued_image_request; + expect_get_image_extents(mock_queued_image_request, {}); + expect_get_tid(mock_queued_image_request, 0); InSequence seq; MockImageRequestWQ mock_image_request_wq(&mock_image_ctx, "io", 60, nullptr); expect_signal(mock_image_request_wq); mock_image_request_wq.set_require_lock(DIRECTION_WRITE, true); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_queue(mock_image_request_wq); auto *aio_comp = new librbd::io::AioCompletion(); mock_image_request_wq.aio_write(aio_comp, 0, 0, {}, 0); @@ -321,15 +321,15 @@ TEST_F(TestMockIoImageRequestWQ, AcquireLockBlacklisted) { librbd::exclusive_lock::MockPolicy mock_exclusive_lock_policy; expect_front(mock_image_request_wq, mock_queued_image_request); expect_is_refresh_request(mock_image_ctx, false); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_dequeue(mock_image_request_wq, mock_queued_image_request); expect_get_exclusive_lock_policy(mock_image_ctx, mock_exclusive_lock_policy); expect_may_auto_request_lock(mock_exclusive_lock_policy, false); EXPECT_CALL(*mock_image_ctx.exclusive_lock, get_unlocked_op_error()) .WillOnce(Return(-EBLACKLISTED)); expect_process_finish(mock_image_request_wq); - expect_fail(*mock_queued_image_request, -EBLACKLISTED); - expect_is_write_op(*mock_queued_image_request, true); + expect_fail(mock_queued_image_request, -EBLACKLISTED); + expect_is_write_op(mock_queued_image_request, true); expect_signal(mock_image_request_wq); ASSERT_TRUE(mock_image_request_wq.invoke_dequeue() == nullptr); @@ -344,21 +344,21 @@ TEST_F(TestMockIoImageRequestWQ, RefreshError) { MockTestImageCtx mock_image_ctx(*ictx); - auto mock_queued_image_request = new MockImageDispatchSpec(); - expect_get_image_extents(*mock_queued_image_request, {}); - expect_get_tid(*mock_queued_image_request, 0); + MockImageDispatchSpec mock_queued_image_request; + expect_get_image_extents(mock_queued_image_request, {}); + expect_get_tid(mock_queued_image_request, 0); InSequence seq; MockImageRequestWQ mock_image_request_wq(&mock_image_ctx, "io", 60, nullptr); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_queue(mock_image_request_wq); auto *aio_comp = new librbd::io::AioCompletion(); mock_image_request_wq.aio_write(aio_comp, 0, 0, {}, 0); expect_front(mock_image_request_wq, mock_queued_image_request); expect_is_refresh_request(mock_image_ctx, true); - expect_is_write_op(*mock_queued_image_request, true); + expect_is_write_op(mock_queued_image_request, true); expect_dequeue(mock_image_request_wq, mock_queued_image_request); Context *on_refresh = nullptr; expect_refresh(mock_image_ctx, &on_refresh); @@ -366,8 +366,8 @@ TEST_F(TestMockIoImageRequestWQ, RefreshError) { ASSERT_TRUE(on_refresh != nullptr); expect_process_finish(mock_image_request_wq); - expect_fail(*mock_queued_image_request, -EPERM); - expect_is_write_op(*mock_queued_image_request, true); + expect_fail(mock_queued_image_request, -EPERM); + expect_is_write_op(mock_queued_image_request, true); expect_signal(mock_image_request_wq); on_refresh->complete(-EPERM); diff --git a/src/test/librbd/journal/test_Replay.cc b/src/test/librbd/journal/test_Replay.cc index 535198e3a7c..1fa86eea492 100644 --- a/src/test/librbd/journal/test_Replay.cc +++ b/src/test/librbd/journal/test_Replay.cc @@ -865,7 +865,6 @@ TEST_F(TestJournalReplay, ObjectPosition) { *ictx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, librbd::io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; ASSERT_EQ(0, flush_ctx.wait()); // check the commit position updated diff --git a/src/test/librbd/operation/test_mock_ResizeRequest.cc b/src/test/librbd/operation/test_mock_ResizeRequest.cc index 71992734282..96dd70127a4 100644 --- a/src/test/librbd/operation/test_mock_ResizeRequest.cc +++ b/src/test/librbd/operation/test_mock_ResizeRequest.cc @@ -251,8 +251,8 @@ TEST_F(TestMockOperationResizeRequest, ShrinkSuccess) { expect_unblock_writes(mock_image_ctx); MockTrimRequest mock_trim_request; - auto mock_io_image_dispatch_spec = new MockIoImageDispatchSpec(); - expect_flush_cache(mock_image_ctx, *mock_io_image_dispatch_spec, 0); + MockIoImageDispatchSpec mock_io_image_dispatch_spec; + expect_flush_cache(mock_image_ctx, mock_io_image_dispatch_spec, 0); expect_invalidate_cache(mock_image_ctx, 0); expect_trim(mock_image_ctx, mock_trim_request, 0); expect_block_writes(mock_image_ctx, 0); @@ -314,8 +314,8 @@ TEST_F(TestMockOperationResizeRequest, TrimError) { expect_unblock_writes(mock_image_ctx); MockTrimRequest mock_trim_request; - auto mock_io_image_dispatch_spec = new MockIoImageDispatchSpec(); - expect_flush_cache(mock_image_ctx, *mock_io_image_dispatch_spec, 0); + MockIoImageDispatchSpec mock_io_image_dispatch_spec; + expect_flush_cache(mock_image_ctx, mock_io_image_dispatch_spec, 0); expect_invalidate_cache(mock_image_ctx, -EBUSY); expect_trim(mock_image_ctx, mock_trim_request, -EINVAL); expect_commit_op_event(mock_image_ctx, -EINVAL); @@ -340,8 +340,8 @@ TEST_F(TestMockOperationResizeRequest, FlushCacheError) { expect_unblock_writes(mock_image_ctx); MockTrimRequest mock_trim_request; - auto mock_io_image_dispatch_spec = new MockIoImageDispatchSpec(); - expect_flush_cache(mock_image_ctx, *mock_io_image_dispatch_spec, -EINVAL); + MockIoImageDispatchSpec mock_io_image_dispatch_spec; + expect_flush_cache(mock_image_ctx, mock_io_image_dispatch_spec, -EINVAL); expect_commit_op_event(mock_image_ctx, -EINVAL); ASSERT_EQ(-EINVAL, when_resize(mock_image_ctx, ictx->size / 2, true, 0, false)); } @@ -364,8 +364,8 @@ TEST_F(TestMockOperationResizeRequest, InvalidateCacheError) { expect_unblock_writes(mock_image_ctx); MockTrimRequest mock_trim_request; - auto mock_io_image_dispatch_spec = new MockIoImageDispatchSpec(); - expect_flush_cache(mock_image_ctx, *mock_io_image_dispatch_spec, 0); + MockIoImageDispatchSpec mock_io_image_dispatch_spec; + expect_flush_cache(mock_image_ctx, mock_io_image_dispatch_spec, 0); expect_invalidate_cache(mock_image_ctx, -EINVAL); expect_commit_op_event(mock_image_ctx, -EINVAL); ASSERT_EQ(-EINVAL, when_resize(mock_image_ctx, ictx->size / 2, true, 0, false)); @@ -388,8 +388,8 @@ TEST_F(TestMockOperationResizeRequest, PostBlockWritesError) { expect_unblock_writes(mock_image_ctx); MockTrimRequest mock_trim_request; - auto mock_io_image_dispatch_spec = new MockIoImageDispatchSpec(); - expect_flush_cache(mock_image_ctx, *mock_io_image_dispatch_spec, 0); + MockIoImageDispatchSpec mock_io_image_dispatch_spec; + expect_flush_cache(mock_image_ctx, mock_io_image_dispatch_spec, 0); expect_invalidate_cache(mock_image_ctx, 0); expect_trim(mock_image_ctx, mock_trim_request, 0); expect_block_writes(mock_image_ctx, -EINVAL); |