]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: prealloc/reserve extent vector for common alloc path
authorSage Weil <sage@redhat.com>
Tue, 17 Jan 2017 16:17:38 +0000 (11:17 -0500)
committerSage Weil <sage@redhat.com>
Wed, 18 Jan 2017 13:38:44 +0000 (07:38 -0600)
No need to worry about the gift/reclaim path--those are very rare.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc

index 065ab25c6adaea56c48340baf156fead263349c8..98c26d23cbd12bf37c7925487f886c60237f8dca 100644 (file)
@@ -1765,6 +1765,7 @@ int BlueFS::_allocate(uint8_t id, uint64_t len,
   }
 
   AllocExtentVector extents;
+  extents.reserve(4);  // 4 should be (more than) enough for most allocations
   int64_t alloc_len = alloc[id]->allocate(left, min_alloc_size, hint,
                           &extents);
   if (alloc_len < (int64_t)left) {
index 5e3270a36337526e82da0ab30d450f962756fd73..96d5ed2f0a95539d5d8c19294542dfcabbeadf89 100644 (file)
@@ -8105,6 +8105,7 @@ int BlueStore::_do_alloc_write(
     }
 
     AllocExtentVector extents;
+    extents.reserve(4);  // 4 should be (more than) enough for most allocations
     int64_t got = alloc->allocate(final_length, min_alloc_size, max_alloc_size,
                             hint, &extents);
     assert(got == (int64_t)final_length);