From: Ramesh Chander Date: Mon, 16 May 2016 21:28:57 +0000 (-0400) Subject: os/bluestore: pass size to allocator X-Git-Tag: v11.0.0~537^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fa4133ec054d1ca5f2c33a0da9ce51730379a741;p=ceph.git os/bluestore: pass size to allocator Signed-off-by: Ramesh Chander --- diff --git a/src/os/bluestore/Allocator.cc b/src/os/bluestore/Allocator.cc index e13229119e7..79c51c43635 100644 --- a/src/os/bluestore/Allocator.cc +++ b/src/os/bluestore/Allocator.cc @@ -7,7 +7,7 @@ #define dout_subsys ceph_subsys_bluestore -Allocator *Allocator::create(string type) +Allocator *Allocator::create(string type, int64_t size) { if (type == "stupid") return new StupidAllocator; diff --git a/src/os/bluestore/Allocator.h b/src/os/bluestore/Allocator.h index 6df2267ca41..964a2aa5af1 100644 --- a/src/os/bluestore/Allocator.h +++ b/src/os/bluestore/Allocator.h @@ -43,8 +43,7 @@ public: virtual uint64_t get_free() = 0; virtual void shutdown() = 0; - - static Allocator *create(string type); + static Allocator *create(string type, int64_t size); }; #endif diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index c8d7f72e006..2d0a3f225fd 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -278,9 +278,11 @@ void BlueFS::_init_alloc() dout(20) << __func__ << dendl; alloc.resize(MAX_BDEV); for (unsigned id = 0; id < bdev.size(); ++id) { - if (!bdev[id]) + if (!bdev[id]) { continue; - alloc[id] = Allocator::create(g_conf->bluestore_allocator); + } + assert(bdev[id]->get_size()); + alloc[id] = Allocator::create(g_conf->bluestore_allocator, bdev[id]->get_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 49c0500bae0..7c24a433f00 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1044,7 +1044,8 @@ void BlueStore::_close_fm() int BlueStore::_open_alloc() { assert(alloc == NULL); - alloc = Allocator::create(g_conf->bluestore_allocator); + assert(bdev->get_size()); + alloc = Allocator::create(g_conf->bluestore_allocator, bdev->get_size()); uint64_t num = 0, bytes = 0; fm->enumerate_reset(); uint64_t offset, length;