]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
bluestore: print aio in batch
authorKefu Chai <kchai@redhat.com>
Fri, 10 Nov 2017 08:00:24 +0000 (16:00 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 11 Nov 2017 16:51:38 +0000 (00:51 +0800)
KernelDevice::aio_{submit,write,read}() are critical paths. calling
cct->_conf->subsys.should_gather() multi-times is not optimal. the
downside of this issue is that if the aio is printed, the size of
buffer in PrebufferedStreambuf could be large if the number of iov is
large, that could be a heavy load to the memory subsystem.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/KernelDevice.cc
src/os/bluestore/aio.cc
src/os/bluestore/aio.h

index cfa626d493e8c11a10ee50f655416870abc0e587..a1720a2523a290c57a44c7c72227d6bd15baa4eb 100644 (file)
@@ -522,10 +522,7 @@ void KernelDevice::aio_submit(IOContext *ioc)
   if (cct->_conf->bdev_debug_aio) {
     list<aio_t>::iterator p = ioc->running_aios.begin();
     while (p != e) {
-      for (auto& io : p->iov)
-       dout(30) << __func__ << "   iov " << (void*)io.iov_base
-                << " len " << io.iov_len << dendl;
-
+      dout(30) << __func__ << " " << *p << dendl;
       std::lock_guard<std::mutex> l(debug_queue_lock);
       debug_aio_link(*p++);
     }
@@ -645,10 +642,7 @@ int KernelDevice::aio_write(
       ++injecting_crash;
     } else {
       bl.prepare_iov(&aio.iov);
-      for (unsigned i=0; i<aio.iov.size(); ++i) {
-       dout(30) << "aio " << i << " " << aio.iov[i].iov_base
-                << " " << aio.iov[i].iov_len << dendl;
-      }
+      dout(30) << aio << dendl;
       aio.bl.claim_append(bl);
       aio.pwritev(off, len);
     }
@@ -712,10 +706,7 @@ int KernelDevice::aio_read(
     ++ioc->num_pending;
     aio_t& aio = ioc->pending_aios.back();
     aio.pread(off, len);
-    for (unsigned i=0; i<aio.iov.size(); ++i) {
-      dout(30) << "aio " << i << " " << aio.iov[i].iov_base
-              << " " << aio.iov[i].iov_len << dendl;
-    }
+    dout(30) << aio << dendl;
     pbl->append(aio.bl);
     dout(5) << __func__ << " 0x" << std::hex << off << "~" << len
            << std::dec << " aio " << &aio << dendl;
index 79166d55f307e3f1e0260b932166a302b5e07455..79e07115bec3260841ef953378e1055ad12ba1f4 100644 (file)
@@ -5,6 +5,17 @@
 
 #if defined(HAVE_LIBAIO)
 
+std::ostream& operator<<(std::ostream& os, const aio_t& aio)
+{
+  unsigned i = 0;
+  os << "aio: ";
+  for (auto& iov : aio.iov) {
+    os << "\n [" << i++ << "] 0x"
+       << std::hex << iov.iov_base << "~" << iov.iov_len << std::dec;
+  }
+  return os;
+}
+
 int aio_queue_t::submit_batch(aio_iter begin, aio_iter end, 
                              uint16_t aios_size, void *priv, 
                              int *retries)
index d95210e20269137da80f2bef3efbd41011201217..0be38beb4c55a87306445ff1414d7b82b866344f 100644 (file)
@@ -45,6 +45,8 @@ struct aio_t {
   }
 };
 
+std::ostream& operator<<(std::ostream& os, const aio_t& aio);
+
 typedef boost::intrusive::list<
   aio_t,
   boost::intrusive::member_hook<