From b3fca67cc35cea2889c6ac70ba3541b0048317a4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 17 Jan 2017 11:17:38 -0500 Subject: [PATCH] os/bluestore: prealloc/reserve extent vector for common alloc path No need to worry about the gift/reclaim path--those are very rare. Signed-off-by: Sage Weil --- src/os/bluestore/BlueFS.cc | 1 + src/os/bluestore/BlueStore.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 065ab25c6ad..98c26d23cbd 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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) { diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 5e3270a3633..96d5ed2f0a9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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);