]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add "requeue_back" WorkQueue method
authorMykola Golub <mgolub@suse.com>
Fri, 15 Mar 2019 15:01:26 +0000 (15:01 +0000)
committerMykola Golub <mgolub@suse.com>
Fri, 15 Mar 2019 15:12:25 +0000 (15:12 +0000)
and rename "requeue" method to "requeue_front" for clarity.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/common/WorkQueue.h
src/librbd/io/ImageRequestWQ.cc
src/test/librbd/io/test_mock_ImageRequestWQ.cc

index d3d76412d36d10bac9c6e9c9eb6844fd3c601486..a978a6d698433f981175b1f95aa8cbec532838eb 100644 (file)
@@ -428,11 +428,16 @@ public:
       }
       return m_items.front();
     }
-    void requeue(T *item) {
+    void requeue_front(T *item) {
       std::lock_guard pool_locker(m_pool->_lock);
       _void_process_finish(nullptr);
       m_items.push_front(item);
     }
+    void requeue_back(T *item) {
+      std::lock_guard pool_locker(m_pool->_lock);
+      _void_process_finish(nullptr);
+      m_items.push_back(item);
+    }
     void signal() {
       std::lock_guard pool_locker(m_pool->_lock);
       m_pool->_cond.notify_one();
index 752ef82c72fbcb525af0108c7289a3b16854feb2..a5101aa04843899c0eada0227d1838755d36ab59 100644 (file)
@@ -661,7 +661,7 @@ void ImageRequestWQ<I>::handle_throttle_ready(int r, ImageDispatchSpec<I> *item,
   ceph_assert(m_io_throttled.load() > 0);
   item->set_throttled(flag);
   if (item->were_all_throttled()) {
-    this->requeue(item);
+    this->requeue_front(item);
     --m_io_throttled;
     this->signal();
   }
@@ -910,7 +910,7 @@ void ImageRequestWQ<I>::handle_acquire_lock(
   } else {
     // since IO was stalled for acquire -- original IO order is preserved
     // if we requeue this op for work queue processing
-    this->requeue(req);
+    this->requeue_front(req);
   }
 
   ceph_assert(m_io_blockers.load() > 0);
@@ -929,7 +929,7 @@ void ImageRequestWQ<I>::handle_refreshed(
   } else {
     // since IO was stalled for refresh -- original IO order is preserved
     // if we requeue this op for work queue processing
-    this->requeue(req);
+    this->requeue_front(req);
   }
 
   ceph_assert(m_io_blockers.load() > 0);
index 2dd72bff76cc23011edac1744dcb418a03844839..352b888d3996bd37057750f83bc817f97361405b 100644 (file)
@@ -104,7 +104,7 @@ struct ThreadPool::PointerWQ<librbd::io::ImageDispatchSpec<librbd::MockTestImage
   MOCK_METHOD0(process_finish, void());
 
   MOCK_METHOD0(front, ImageDispatchSpec*());
-  MOCK_METHOD1(requeue, void(ImageDispatchSpec*));
+  MOCK_METHOD1(requeue_front, void(ImageDispatchSpec*));
 
   MOCK_METHOD0(dequeue, void*());
   MOCK_METHOD1(queue, void(ImageDispatchSpec*));
@@ -170,8 +170,8 @@ struct TestMockIoImageRequestWQ : public TestMockFixture {
     EXPECT_CALL(image_request_wq, queue(_));
   }
 
-  void expect_requeue(MockImageRequestWQ &image_request_wq) {
-    EXPECT_CALL(image_request_wq, requeue(_));
+  void expect_requeue_front(MockImageRequestWQ &image_request_wq) {
+    EXPECT_CALL(image_request_wq, requeue_front(_));
   }
 
   void expect_front(MockImageRequestWQ &image_request_wq,
@@ -425,7 +425,7 @@ TEST_F(TestMockIoImageRequestWQ, BPSQosNoBurst) {
   expect_tokens_requested(mock_queued_image_request, 2, true);
   expect_dequeue(mock_image_request_wq, &mock_queued_image_request);
   expect_all_throttled(mock_queued_image_request, true);
-  expect_requeue(mock_image_request_wq);
+  expect_requeue_front(mock_image_request_wq);
   expect_signal(mock_image_request_wq);
   ASSERT_TRUE(mock_image_request_wq.invoke_dequeue() == nullptr);
 }
@@ -449,7 +449,7 @@ TEST_F(TestMockIoImageRequestWQ, BPSQosWithBurst) {
   expect_tokens_requested(mock_queued_image_request, 2, true);
   expect_dequeue(mock_image_request_wq, &mock_queued_image_request);
   expect_all_throttled(mock_queued_image_request, true);
-  expect_requeue(mock_image_request_wq);
+  expect_requeue_front(mock_image_request_wq);
   expect_signal(mock_image_request_wq);
   ASSERT_TRUE(mock_image_request_wq.invoke_dequeue() == nullptr);
 }