From: Sage Weil Date: Wed, 10 Jul 2019 15:21:12 +0000 (-0500) Subject: bluestore: print aio in batch X-Git-Tag: v12.2.13~193^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a52716cc9465a600f7e0e093dc33862615eb90e;p=ceph.git bluestore: print aio in batch 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 (cherry picked from commit 67c6f768add46d92d9403ca6b7709b892d8a686d) # Conflicts: # src/os/bluestore/aio.cc - adjacent to aio_queue_t::submit() --- diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 124a29bbdbc..6d34f0935ae 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -531,10 +531,7 @@ void KernelDevice::aio_submit(IOContext *ioc) if (cct->_conf->bdev_debug_aio) { list::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 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; inum_pending; aio_t& aio = ioc->pending_aios.back(); aio.pread(off, len); - for (unsigned i=0; iappend(aio.bl); dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << " aio " << &aio << dendl; diff --git a/src/os/bluestore/aio.cc b/src/os/bluestore/aio.cc index 256f3db97fd..656054f2669 100644 --- a/src/os/bluestore/aio.cc +++ b/src/os/bluestore/aio.cc @@ -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) diff --git a/src/os/bluestore/aio.h b/src/os/bluestore/aio.h index b2739d44cbe..1095aa00344 100644 --- a/src/os/bluestore/aio.h +++ b/src/os/bluestore/aio.h @@ -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<