From: Sage Weil Date: Thu, 27 Apr 2017 20:38:54 +0000 (-0400) Subject: os/fs: use small_vector for aio_t::iov (instead of std::vector) X-Git-Tag: v12.0.3~137^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b006b362fbdbf243e85806c4a9a21c3bfa0e56b3;p=ceph.git os/fs: use small_vector for aio_t::iov (instead of std::vector) These are usually small per io. Avoid an additional allocation. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 0793be729161..e73c439566e6 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -499,9 +499,9 @@ void KernelDevice::aio_submit(IOContext *ioc) dout(20) << __func__ << " aio " << &aio << " fd " << aio.fd << " 0x" << std::hex << aio.offset << "~" << aio.length << std::dec << dendl; - for (vector::iterator q = aio.iov.begin(); q != aio.iov.end(); ++q) - dout(30) << __func__ << " iov " << (void*)q->iov_base - << " len " << q->iov_len << dendl; + for (auto& io : aio.iov) + dout(30) << __func__ << " iov " << (void*)io.iov_base + << " len " << io.iov_len << dendl; // be careful: as soon as we submit aio we race with completion. // since we are holding a ref take care not to dereference txc at diff --git a/src/os/fs/FS.h b/src/os/fs/FS.h index 0dc8dcb3764f..68ff65368025 100644 --- a/src/os/fs/FS.h +++ b/src/os/fs/FS.h @@ -29,6 +29,7 @@ #include "common/Mutex.h" #include "common/Cond.h" #include +#include class FS { public: @@ -57,7 +58,7 @@ public: struct iocb iocb; // must be first element; see shenanigans in aio_queue_t void *priv; int fd; - vector iov; + boost::container::small_vector iov; uint64_t offset, length; int rval; bufferlist bl; ///< write payload (so that it remains stable for duration)