diff options
-rw-r--r-- | src/librbd/api/DiffIterate.cc | 1 | ||||
-rw-r--r-- | src/librbd/image/CloseRequest.cc | 1 | ||||
-rw-r--r-- | src/librbd/image/RefreshRequest.cc | 1 | ||||
-rw-r--r-- | src/librbd/io/ImageDispatchSpec.cc | 51 | ||||
-rw-r--r-- | src/librbd/io/ImageDispatchSpec.h | 6 | ||||
-rw-r--r-- | src/librbd/io/ImageDispatcher.cc | 6 | ||||
-rw-r--r-- | src/librbd/io/ImageDispatcher.h | 3 | ||||
-rw-r--r-- | src/librbd/io/ImageRequestWQ.cc | 65 | ||||
-rw-r--r-- | src/librbd/operation/ResizeRequest.cc | 1 | ||||
-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 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_ImageSync.cc | 1 |
13 files changed, 58 insertions, 149 deletions
diff --git a/src/librbd/api/DiffIterate.cc b/src/librbd/api/DiffIterate.cc index 4235679507d..d0dffb11dfd 100644 --- a/src/librbd/api/DiffIterate.cc +++ b/src/librbd/api/DiffIterate.cc @@ -254,7 +254,6 @@ int DiffIterate<I>::diff_iterate(I *ictx, *ictx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; } int r = flush_ctx.wait(); if (r < 0) { diff --git a/src/librbd/image/CloseRequest.cc b/src/librbd/image/CloseRequest.cc index 5dba010b4be..9296e42da91 100644 --- a/src/librbd/image/CloseRequest.cc +++ b/src/librbd/image/CloseRequest.cc @@ -172,7 +172,6 @@ void CloseRequest<I>::send_flush() { *m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; } template <typename I> diff --git a/src/librbd/image/RefreshRequest.cc b/src/librbd/image/RefreshRequest.cc index be887664295..25c30816711 100644 --- a/src/librbd/image/RefreshRequest.cc +++ b/src/librbd/image/RefreshRequest.cc @@ -1233,7 +1233,6 @@ Context *RefreshRequest<I>::send_flush_aio() { m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; return nullptr; } else if (m_error_result < 0) { // propagate saved error back to caller diff --git a/src/librbd/io/ImageDispatchSpec.cc b/src/librbd/io/ImageDispatchSpec.cc index 5c21e5969f5..2ca0d82127b 100644 --- a/src/librbd/io/ImageDispatchSpec.cc +++ b/src/librbd/io/ImageDispatchSpec.cc @@ -44,54 +44,6 @@ void ImageDispatchSpec<I>::C_Dispatcher::finish(int r) { } template <typename I> -struct ImageDispatchSpec<I>::SendVisitor - : public boost::static_visitor<void> { - ImageDispatchSpec* spec; - - explicit SendVisitor(ImageDispatchSpec* spec) - : spec(spec) { - } - - void operator()(Read& read) const { - ImageRequest<I>::aio_read( - &spec->m_image_ctx, spec->aio_comp, std::move(spec->image_extents), - std::move(read.read_result), spec->op_flags, spec->parent_trace); - } - - void operator()(Discard& discard) const { - ImageRequest<I>::aio_discard( - &spec->m_image_ctx, spec->aio_comp, std::move(spec->image_extents), - discard.discard_granularity_bytes, spec->parent_trace); - } - - void operator()(Write& write) const { - ImageRequest<I>::aio_write( - &spec->m_image_ctx, spec->aio_comp, std::move(spec->image_extents), - std::move(write.bl), spec->op_flags, spec->parent_trace); - } - - void operator()(WriteSame& write_same) const { - ImageRequest<I>::aio_writesame( - &spec->m_image_ctx, spec->aio_comp, std::move(spec->image_extents), - std::move(write_same.bl), spec->op_flags, spec->parent_trace); - } - - void operator()(CompareAndWrite& compare_and_write) const { - ImageRequest<I>::aio_compare_and_write( - &spec->m_image_ctx, spec->aio_comp, std::move(spec->image_extents), - std::move(compare_and_write.cmp_bl), std::move(compare_and_write.bl), - compare_and_write.mismatch_offset, spec->op_flags, - spec->parent_trace); - } - - void operator()(Flush& flush) const { - ImageRequest<I>::aio_flush( - &spec->m_image_ctx, spec->aio_comp, flush.flush_source, - spec->parent_trace); - } -}; - -template <typename I> struct ImageDispatchSpec<I>::IsWriteOpVisitor : public boost::static_visitor<bool> { bool operator()(const Read&) const { @@ -106,7 +58,7 @@ struct ImageDispatchSpec<I>::IsWriteOpVisitor template <typename I> void ImageDispatchSpec<I>::send() { - boost::apply_visitor(SendVisitor{this}, request); + image_dispatcher->send(this); } template <typename I> @@ -149,6 +101,7 @@ bool ImageDispatchSpec<I>::is_write_op() const { template <typename I> void ImageDispatchSpec<I>::start_op() { + tid = 0; aio_comp->start_op(); } diff --git a/src/librbd/io/ImageDispatchSpec.h b/src/librbd/io/ImageDispatchSpec.h index 3b17414e31a..e489e94b23a 100644 --- a/src/librbd/io/ImageDispatchSpec.h +++ b/src/librbd/io/ImageDispatchSpec.h @@ -203,13 +203,11 @@ private: : dispatcher_ctx(this), image_dispatcher(image_ctx.io_image_dispatcher), dispatch_layer(image_dispatch_layer), aio_comp(aio_comp), image_extents(std::move(image_extents)), request(std::move(request)), - op_flags(op_flags), parent_trace(parent_trace), tid(tid), - m_image_ctx(image_ctx) { + op_flags(op_flags), parent_trace(parent_trace), tid(tid) { + aio_comp->image_dispatcher_ctx = &dispatcher_ctx; aio_comp->get(); } - ImageCtxT& m_image_ctx; - void finish(int r); uint64_t extents_length(); diff --git a/src/librbd/io/ImageDispatcher.cc b/src/librbd/io/ImageDispatcher.cc index b9e00e15c19..c1016ea9e46 100644 --- a/src/librbd/io/ImageDispatcher.cc +++ b/src/librbd/io/ImageDispatcher.cc @@ -157,7 +157,7 @@ template <typename I> void ImageDispatcher<I>::finish(int r, ImageDispatchLayer image_dispatch_layer, uint64_t tid) { auto cct = this->m_image_ctx->cct; - ldout(cct, 20) << "tid=" << tid << dendl; + ldout(cct, 20) << "r=" << r << ", tid=" << tid << dendl; // loop in reverse order from last invoked dispatch layer calling its // handle_finished method @@ -189,6 +189,10 @@ template <typename I> bool ImageDispatcher<I>::send_dispatch( ImageDispatchInterface* image_dispatch, ImageDispatchSpec<I>* image_dispatch_spec) { + if (image_dispatch_spec->tid == 0) { + image_dispatch_spec->tid = ++m_next_tid; + } + return boost::apply_visitor( SendVisitor{image_dispatch, image_dispatch_spec}, image_dispatch_spec->request); diff --git a/src/librbd/io/ImageDispatcher.h b/src/librbd/io/ImageDispatcher.h index b1de734be28..7628cd38d16 100644 --- a/src/librbd/io/ImageDispatcher.h +++ b/src/librbd/io/ImageDispatcher.h @@ -11,6 +11,7 @@ #include "librbd/io/ImageDispatchSpec.h" #include "librbd/io/ImageDispatcherInterface.h" #include "librbd/io/Types.h" +#include <atomic> #include <map> struct Context; @@ -50,6 +51,8 @@ protected: private: struct SendVisitor; + std::atomic<uint64_t> m_next_tid{0}; + QueueImageDispatch<ImageCtxT>* m_queue_image_dispatch = nullptr; QosImageDispatch<ImageCtxT>* m_qos_image_dispatch = nullptr; diff --git a/src/librbd/io/ImageRequestWQ.cc b/src/librbd/io/ImageRequestWQ.cc index 968a54ce775..4172179286b 100644 --- a/src/librbd/io/ImageRequestWQ.cc +++ b/src/librbd/io/ImageRequestWQ.cc @@ -30,21 +30,6 @@ using util::create_context_callback; namespace io { -namespace { - -template <typename I> -void flush_image(I& image_ctx, Context* on_finish) { - auto aio_comp = librbd::io::AioCompletion::create_and_start( - on_finish, util::get_image_ctx(&image_ctx), librbd::io::AIO_TYPE_FLUSH); - auto req = librbd::io::ImageDispatchSpec<I>::create_flush_request( - image_ctx, IMAGE_DISPATCH_LAYER_API_START, aio_comp, FLUSH_SOURCE_INTERNAL, - {}); - req->send(); - delete req; -} - -} // anonymous namespace - template <typename I> struct ImageRequestWQ<I>::C_AcquireLock : public Context { ImageRequestWQ *work_queue; @@ -316,12 +301,7 @@ void ImageRequestWQ<I>::aio_write(AioCompletion *c, uint64_t off, uint64_t len, op_flags, trace, tid); std::shared_lock owner_locker{m_image_ctx.owner_lock}; - if (m_image_ctx.non_blocking_aio || writes_blocked()) { - queue(req); - } else { - process_io(req, false); - finish_in_flight_io(); - } + queue(req); trace.event("finish"); } @@ -363,12 +343,7 @@ void ImageRequestWQ<I>::aio_discard(AioCompletion *c, uint64_t off, discard_granularity_bytes, trace, tid); std::shared_lock owner_locker{m_image_ctx.owner_lock}; - if (m_image_ctx.non_blocking_aio || writes_blocked()) { - queue(req); - } else { - process_io(req, false); - finish_in_flight_io(); - } + queue(req); trace.event("finish"); } @@ -410,12 +385,7 @@ void ImageRequestWQ<I>::aio_flush(AioCompletion *c, bool native_async) { } std::shared_lock owner_locker{m_image_ctx.owner_lock}; - if (m_image_ctx.non_blocking_aio || writes_blocked() || !writes_empty()) { - queue(req); - } else { - process_io(req, false); - finish_in_flight_io(); - } + queue(req); trace.event("finish"); } @@ -457,12 +427,7 @@ void ImageRequestWQ<I>::aio_writesame(AioCompletion *c, uint64_t off, op_flags, trace, tid); std::shared_lock owner_locker{m_image_ctx.owner_lock}; - if (m_image_ctx.non_blocking_aio || writes_blocked()) { - queue(req); - } else { - process_io(req, false); - finish_in_flight_io(); - } + queue(req); trace.event("finish"); } @@ -506,12 +471,7 @@ void ImageRequestWQ<I>::aio_compare_and_write(AioCompletion *c, std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, trace, tid); std::shared_lock owner_locker{m_image_ctx.owner_lock}; - if (m_image_ctx.non_blocking_aio || writes_blocked()) { - queue(req); - } else { - process_io(req, false); - finish_in_flight_io(); - } + queue(req); trace.event("finish"); } @@ -623,8 +583,7 @@ void ImageRequestWQ<I>::shut_down(Context *on_shutdown) { } } - // ensure that all in-flight IO is flushed - flush_image(m_image_ctx, on_shutdown); + m_image_ctx.op_work_queue->queue(on_shutdown, 0); } template <typename I> @@ -643,8 +602,7 @@ void ImageRequestWQ<I>::block_writes(Context *on_blocked) { } } - // ensure that all in-flight IO is flushed - flush_image(m_image_ctx, on_blocked); + m_image_ctx.op_work_queue->queue(on_blocked, 0); } template <typename I> @@ -844,7 +802,6 @@ void ImageRequestWQ<I>::process_io(ImageDispatchSpec<I> *req, unblock_overlapping_io(offset, length, tid); unblock_flushes(); } - delete req; } template <typename I> @@ -909,8 +866,10 @@ void ImageRequestWQ<I>::finish_in_flight_write() { writes_blocked = true; } } + if (writes_blocked) { - flush_image(m_image_ctx, new C_BlockedWrites(this)); + m_image_ctx.op_work_queue->queue(create_context_callback< + ImageRequestWQ<I>, &ImageRequestWQ<I>::handle_blocked_writes>(this), 0); } } @@ -952,8 +911,7 @@ void ImageRequestWQ<I>::finish_in_flight_io() { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << "completing shut down" << dendl; - ceph_assert(on_shutdown != nullptr); - flush_image(m_image_ctx, on_shutdown); + on_shutdown->complete(0); } template <typename I> @@ -970,7 +928,6 @@ void ImageRequestWQ<I>::fail_in_flight_io( finish_queued_io(write_op); remove_in_flight_write_ios(offset, length, write_op, tid); - delete req; finish_in_flight_io(); } diff --git a/src/librbd/operation/ResizeRequest.cc b/src/librbd/operation/ResizeRequest.cc index 6179df66b17..4d8c51bb2a3 100644 --- a/src/librbd/operation/ResizeRequest.cc +++ b/src/librbd/operation/ResizeRequest.cc @@ -200,7 +200,6 @@ void ResizeRequest<I>::send_flush_cache() { image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; } template <typename I> 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); diff --git a/src/test/rbd_mirror/test_ImageSync.cc b/src/test/rbd_mirror/test_ImageSync.cc index 2a830609fc7..d97804fefed 100644 --- a/src/test/rbd_mirror/test_ImageSync.cc +++ b/src/test/rbd_mirror/test_ImageSync.cc @@ -39,7 +39,6 @@ int flush(librbd::ImageCtx *image_ctx) { *image_ctx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp, librbd::io::FLUSH_SOURCE_INTERNAL, {}); req->send(); - delete req; return ctx.wait(); } |