]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: splice cr: don't wake up writer continuously
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 11 Apr 2018 01:11:10 +0000 (18:11 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 25 Apr 2018 16:03:53 +0000 (09:03 -0700)
Just send a notification to the writer once we passed a threshold. With
a slow writer we'd wake it up continuously while it's waiting for
the data to flush.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rest.cc
src/rgw/rgw_cr_rest.h

index 2d602fc77c93981510cbb25ea4b2556520cbbe03..bc5a688b4227bb24df9d3909533f79665f648af4 100644 (file)
@@ -15,7 +15,13 @@ RGWCRHTTPGetDataCB::RGWCRHTTPGetDataCB(RGWCoroutinesEnv *_env, RGWCoroutine *_cr
   req->set_in_cb(this);
 }
 
+#define GET_DATA_WINDOW_SIZE 2 * 1024 * 1024
+
 int RGWCRHTTPGetDataCB::handle_data(bufferlist& bl, bool *pause) {
+  if (data.length() < GET_DATA_WINDOW_SIZE / 2) {
+    notified = false;
+  }
+
   {
     uint64_t bl_len = bl.length();
 
@@ -34,9 +40,9 @@ int RGWCRHTTPGetDataCB::handle_data(bufferlist& bl, bool *pause) {
     data.append(bl);
   }
 
-#define GET_DATA_WINDOW_SIZE 2 * 1024 * 1024
   uint64_t data_len = data.length();
-  if (data_len >= GET_DATA_WINDOW_SIZE) {
+  if (data_len >= GET_DATA_WINDOW_SIZE && !notified) {
+    notified = true;
     env->manager->io_complete(cr, io_id);
   }
   if (data_len >= 2 * GET_DATA_WINDOW_SIZE) {
index 63477f7ad270ed3c9f831d15ce884c51600967a9..87fee91ed5794ba4fa315a27cf51111ed94c701f 100644 (file)
@@ -332,6 +332,7 @@ class RGWCRHTTPGetDataCB : public RGWHTTPStreamRWRequest::ReceiveCB {
   bufferlist extra_data;
   bool got_all_extra_data{false};
   bool paused{false};
+  bool notified{false};
 public:
   RGWCRHTTPGetDataCB(RGWCoroutinesEnv *_env, RGWCoroutine *_cr, RGWHTTPStreamRWRequest *_req);