]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
bluestore: print aio in batch
authorSage Weil <sage@redhat.com>
Wed, 10 Jul 2019 15:21:12 +0000 (10:21 -0500)
committerSage Weil <sage@redhat.com>
Wed, 10 Jul 2019 15:21:12 +0000 (10:21 -0500)
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>
(cherry picked from commit 67c6f768add46d92d9403ca6b7709b892d8a686d)

# Conflicts:
# src/os/bluestore/aio.cc
 - adjacent to aio_queue_t::submit()

src/os/bluestore/KernelDevice.cc
src/os/bluestore/aio.cc
src/os/bluestore/aio.h

index 124a29bbdbcfd2821148a3c75aefd16ec9a62f6d..6d34f0935ae7b35b972b51691aeee41766d28328 100644 (file)
@@ -531,10 +531,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++);
     }
@@ -658,10 +655,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);
     }
@@ -733,10 +727,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 256f3db97fd551f2d8a91c8f533835db4b886bb5..656054f2669824ff72fa45b00a5dbacf6f867618 100644 (file)
@@ -30,6 +30,17 @@ int aio_queue_t::submit(aio_t &aio, int *retries)
   return r;
 }
 
+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 b2739d44cbe540ce875f8713feb73bbeb6d7782a..1095aa003448827d19580ac44a6ca107c377eb0c 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<