]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: support calculate cost when using spdk.
authorPan Liu <wanjun.lp@alibaba-inc.com>
Fri, 18 Aug 2017 13:31:46 +0000 (21:31 +0800)
committerPan Liu <wanjun.lp@alibaba-inc.com>
Mon, 21 Aug 2017 02:02:25 +0000 (10:02 +0800)
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
src/os/bluestore/BlockDevice.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/NVMEDevice.cc

index a90cedeb8543da5ca0a8f3d4e419fb98447d833a..37e65ff3ec0741bb8e2584444d8af1dc5dfb89ac 100644 (file)
@@ -39,6 +39,7 @@ public:
 #ifdef HAVE_SPDK
   void *nvme_task_first = nullptr;
   void *nvme_task_last = nullptr;
+  std::atomic_int total_nseg = {0};
 #endif
 
 
index 1e2d263197897af89599d8d4bfa51384b6f7f914..5da13aa2b5b273b3b502bbaa16e234e993bec2b9 100644 (file)
@@ -7657,6 +7657,11 @@ void BlueStore::_txc_calc_cost(TransContext *txc)
   for (auto& p : txc->ioc.pending_aios) {
     ios += p.iov.size();
   }
+
+#ifdef HAVE_SPDK
+  ios += txc->ioc.total_nseg;
+#endif
+
   auto cost = throttle_cost_per_io.load();
   txc->cost = ios * cost + txc->bytes;
   dout(10) << __func__ << " " << txc << " cost " << txc->cost << " ("
index 2ff5dac335757410d596fe4f80caa0989cb86b9f..5660540ce088bb04ecdd7207b3d660038dc3c431 100644 (file)
@@ -320,6 +320,7 @@ struct Task {
       for (uint16_t i = 0; i < io_request.nseg; i++)
         queue_data->data_buf_mempool.push_back(io_request.inline_segs[i]);
     }
+    ctx->total_nseg -= io_request.nseg;
     io_request.nseg = 0;
   }
 
@@ -423,6 +424,7 @@ int SharedDriverQueueData::alloc_buf_from_pool(Task *t, bool write)
     data_buf_mempool.pop_back();
   }
   t->io_request.nseg = count;
+  t->ctx->total_nseg += count;
   if (write) {
     auto blp = t->write_bl.begin();
     uint32_t len = 0;