]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/fs: use small_vector for aio_t::iov (instead of std::vector)
authorSage Weil <sage@redhat.com>
Thu, 27 Apr 2017 20:38:54 +0000 (16:38 -0400)
committerSage Weil <sage@redhat.com>
Thu, 27 Apr 2017 20:38:54 +0000 (16:38 -0400)
These are usually small per io.  Avoid an additional allocation.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/KernelDevice.cc
src/os/fs/FS.h

index 0793be729161d1e167530dbe367d5d995f60bff1..e73c439566e6230f0cf4850aa743f374a7bde9cf 100644 (file)
@@ -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<iovec>::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
index 0dc8dcb3764f031df851d656070eaa9785921150..68ff6536802528d5cca02a729dc42f479e5da6ce 100644 (file)
@@ -29,6 +29,7 @@
 #include "common/Mutex.h"
 #include "common/Cond.h"
 #include <boost/intrusive/list.hpp>
+#include <boost/container/small_vector.hpp>
 
 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<iovec> iov;
+    boost::container::small_vector<iovec,4> iov;
     uint64_t offset, length;
     int rval;
     bufferlist bl;  ///< write payload (so that it remains stable for duration)