From: Mykola Golub Date: Fri, 15 Mar 2019 15:01:26 +0000 (+0000) Subject: common: add "requeue_back" WorkQueue method X-Git-Tag: v15.0.0~205^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=060ef69eb4ce8473ea5ecc796027729dff883269;p=ceph-ci.git common: add "requeue_back" WorkQueue method and rename "requeue" method to "requeue_front" for clarity. Signed-off-by: Mykola Golub --- diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index d3d76412d36..a978a6d6984 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 752ef82c72f..a5101aa0484 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 2dd72bff76c..352b888d399 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