Skip to content

Commit

Permalink
bluestore: print aio in batch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tchaikov committed Nov 10, 2017
1 parent 9ef5f20 commit f2d526e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/os/bluestore/KernelDevice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/os/bluestore/aio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@

#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++ << "] " << iov.iov_base << " " << iov.iov_len;
}
return os;
}

int aio_queue_t::submit_batch(aio_iter begin, aio_iter end,
uint16_t aios_size, void *priv,
int *retries)
Expand Down
2 changes: 2 additions & 0 deletions src/os/bluestore/aio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit f2d526e

Please sign in to comment.