From 50f20d39f53c54d76e9199d41faa0104cd2ec0d7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 28 Apr 2017 12:05:35 -0500 Subject: [PATCH] os/bluestore: put bluefs in the middle of the shared device If this is an HDD, this will be a shorter average seek distance for an aged device. If it is an SSD, it doesn't matter, so don't bother with making this conditional on is_rotational(). Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 61ada2584ff..0cffbd53cce 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4234,9 +4234,11 @@ int BlueStore::_open_db(bool create, bool kv_no_open) initial = MAX(initial, cct->_conf->bluestore_bluefs_min); // align to bluefs's alloc_size initial = P2ROUNDUP(initial, cct->_conf->bluefs_alloc_size); - initial += cct->_conf->bluefs_alloc_size - SUPER_RESERVED; - bluefs->add_block_extent(bluefs_shared_bdev, SUPER_RESERVED, initial); - bluefs_extents.insert(SUPER_RESERVED, initial); + // put bluefs in the middle of the device in case it is an HDD + uint64_t start = P2ALIGN((bdev->get_size() - initial) / 2, + cct->_conf->bluefs_alloc_size); + bluefs->add_block_extent(bluefs_shared_bdev, start, initial); + bluefs_extents.insert(start, initial); } bfn = path + "/block.wal"; -- 2.47.3