From dcb101eab351cb842441b9ff23f58954881a9174 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Fri, 15 Mar 2019 15:01:26 +0000 Subject: [PATCH] common: add "requeue_back" WorkQueue method and rename "requeue" method to "requeue_front" for clarity. Signed-off-by: Mykola Golub (cherry picked from commit 060ef69eb4ce8473ea5ecc796027729dff883269) --- src/common/WorkQueue.h | 7 ++++++- src/librbd/io/ImageRequestWQ.cc | 6 +++--- src/test/librbd/io/test_mock_ImageRequestWQ.cc | 10 +++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index d3d76412d36d1..a978a6d698433 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -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(); diff --git a/src/librbd/io/ImageRequestWQ.cc b/src/librbd/io/ImageRequestWQ.cc index 752ef82c72fbc..a5101aa048438 100644 --- a/src/librbd/io/ImageRequestWQ.cc +++ b/src/librbd/io/ImageRequestWQ.cc @@ -661,7 +661,7 @@ void ImageRequestWQ::handle_throttle_ready(int r, ImageDispatchSpec *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::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::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); diff --git a/src/test/librbd/io/test_mock_ImageRequestWQ.cc b/src/test/librbd/io/test_mock_ImageRequestWQ.cc index 2dd72bff76cc2..352b888d3996b 100644 --- a/src/test/librbd/io/test_mock_ImageRequestWQ.cc +++ b/src/test/librbd/io/test_mock_ImageRequestWQ.cc @@ -104,7 +104,7 @@ struct ThreadPool::PointerWQ