]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #17032 from yangdongsheng/rbd_qos
authorJason Dillaman <dillaman@redhat.com>
Tue, 14 Nov 2017 23:57:16 +0000 (18:57 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 15 Nov 2017 00:58:13 +0000 (19:58 -0500)
rbd: implement image qos in tokenbucket algorithm

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
1  2 
src/common/options.cc
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/io/ImageRequestWQ.cc

Simple merge
Simple merge
Simple merge
index 7f479f45e96cb7a589eb79d1eb87201d7f6a0d26,9970f8fe3725e09af7ea7af312610545321b93e6..e57aa18fbfbb29e1ba744886f855c5571fd482a8
@@@ -541,6 -553,21 +553,25 @@@ void ImageRequestWQ<I>::set_require_loc
    }
  }
  
 -void ImageRequestWQ<I>::handle_iops_throttle_ready(int r, ImageRequest<I> *item) {
+ template <typename I>
+ void ImageRequestWQ<I>::apply_qos_iops_limit(uint64_t limit) {
+   iops_throttle->set_max(limit);
+   iops_throttle->set_average(limit);
+ }
+ template <typename I>
++void ImageRequestWQ<I>::handle_iops_throttle_ready(int r,
++                                                   ImageRequest<I> *item) {
++  CephContext *cct = m_image_ctx.cct;
++  ldout(cct, 15) << "r=" << r << ", " << "req=" << item << dendl;
++
+   assert(m_io_blockers.load() > 0);
+   --m_io_blockers;
+   item->set_throttled();
+   this->requeue(item);
+   this->signal();
+ }
  template <typename I>
  void *ImageRequestWQ<I>::_void_dequeue() {
    CephContext *cct = m_image_ctx.cct;
      return nullptr;
    }
  
++  if (!peek_item->was_throttled() &&
++      iops_throttle->get<
++        ImageRequestWQ<I>, ImageRequest<I>,
++        &ImageRequestWQ<I>::handle_iops_throttle_ready>(1, this, peek_item)) {
++    ldout(cct, 15) << "throttling IO " << peek_item << dendl;
++
++    // dequeue the throttled item and block future IO
++    ThreadPool::PointerWQ<ImageRequest<I> >::_void_dequeue();
++    ++m_io_blockers;
++    return nullptr;
++  }
++
    bool lock_required;
    bool refresh_required = m_image_ctx.state->is_refresh_required();
    {