From 251dd460bf173539fd88cf3308fa02d947213b87 Mon Sep 17 00:00:00 2001 From: Ramesh Chander Date: Tue, 7 Jun 2016 00:32:53 -0700 Subject: [PATCH] correct allocation block size for bluestore and bluefs Signed-off-by: Ramesh Chander --- src/os/bluestore/Allocator.cc | 5 +++-- src/os/bluestore/Allocator.h | 2 +- src/os/bluestore/BitMapAllocator.cc | 3 +-- src/os/bluestore/BitMapAllocator.h | 2 +- src/os/bluestore/BlueFS.cc | 4 +++- src/os/bluestore/BlueStore.cc | 4 +++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/Allocator.cc b/src/os/bluestore/Allocator.cc index 034fca660e0b4..115bd0cfa4485 100644 --- a/src/os/bluestore/Allocator.cc +++ b/src/os/bluestore/Allocator.cc @@ -8,12 +8,13 @@ #define dout_subsys ceph_subsys_bluestore -Allocator *Allocator::create(string type, int64_t size) +Allocator *Allocator::create(string type, + int64_t size, int64_t block_size) { if (type == "stupid") { return new StupidAllocator; } else if (type == "bitmap") { - return new BitMapAllocator(size); + return new BitMapAllocator(size, block_size); } derr << "Allocator::" << __func__ << " unknown alloc type " << type << dendl; return NULL; diff --git a/src/os/bluestore/Allocator.h b/src/os/bluestore/Allocator.h index 964a2aa5af1ad..d951142d9ce42 100644 --- a/src/os/bluestore/Allocator.h +++ b/src/os/bluestore/Allocator.h @@ -43,7 +43,7 @@ public: virtual uint64_t get_free() = 0; virtual void shutdown() = 0; - static Allocator *create(string type, int64_t size); + static Allocator *create(string type, int64_t size, int64_t block_size); }; #endif diff --git a/src/os/bluestore/BitMapAllocator.cc b/src/os/bluestore/BitMapAllocator.cc index 57356704bec09..077ff875af5d8 100644 --- a/src/os/bluestore/BitMapAllocator.cc +++ b/src/os/bluestore/BitMapAllocator.cc @@ -19,11 +19,10 @@ #define dout_prefix *_dout << "bitmapalloc:" -BitMapAllocator::BitMapAllocator(int64_t device_size) +BitMapAllocator::BitMapAllocator(int64_t device_size, int64_t block_size) : m_num_uncommitted(0), m_num_committing(0) { - int64_t block_size = g_conf->bdev_block_size; int64_t zone_size_blks = 1024; // Change it later m_block_size = block_size; diff --git a/src/os/bluestore/BitMapAllocator.h b/src/os/bluestore/BitMapAllocator.h index e5cd32b1645e2..cb6002527b462 100644 --- a/src/os/bluestore/BitMapAllocator.h +++ b/src/os/bluestore/BitMapAllocator.h @@ -26,7 +26,7 @@ class BitMapAllocator : public Allocator { public: BitMapAllocator(); - BitMapAllocator(int64_t device_size); + BitMapAllocator(int64_t device_size, int64_t block_size); ~BitMapAllocator(); int reserve(uint64_t need); diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index da0ff9a4c73c1..3a4610a4f08bf 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -286,7 +286,9 @@ void BlueFS::_init_alloc() continue; } assert(bdev[id]->get_size()); - alloc[id] = Allocator::create(g_conf->bluestore_allocator, bdev[id]->get_size()); + alloc[id] = Allocator::create(g_conf->bluestore_allocator, + bdev[id]->get_size(), + g_conf->bluefs_alloc_size); interval_set& p = block_all[id]; for (interval_set::iterator q = p.begin(); q != p.end(); ++q) { alloc[id]->init_add_free(q.get_start(), q.get_len()); diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 149635124c1a4..c58779101feaf 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1416,7 +1416,9 @@ int BlueStore::_open_alloc() { assert(alloc == NULL); assert(bdev->get_size()); - alloc = Allocator::create(g_conf->bluestore_allocator, bdev->get_size()); + alloc = Allocator::create(g_conf->bluestore_allocator, + bdev->get_size(), + min_alloc_size); uint64_t num = 0, bytes = 0; fm->enumerate_reset(); uint64_t offset, length; -- 2.39.5