]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: pass size to allocator
authorRamesh Chander <Ramesh.Chander@sandisk.com>
Mon, 16 May 2016 21:28:57 +0000 (17:28 -0400)
committerSage Weil <sage@redhat.com>
Mon, 16 May 2016 21:32:37 +0000 (17:32 -0400)
Signed-off-by: Ramesh Chander <Ramesh.Chander@sandisk.com>
src/os/bluestore/Allocator.cc
src/os/bluestore/Allocator.h
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc

index e13229119e719c62a3c7297be57eed068cabecbb..79c51c43635f3838de51441b766d249300dadb14 100644 (file)
@@ -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;
index 6df2267ca41c124dd148adfed6095455ff25f43d..964a2aa5af1ad52f756bd4b5ff7085ce7550cd35 100644 (file)
@@ -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
index c8d7f72e006c886e52925d8c33d1d2a68dfeb609..2d0a3f225fdd2458822d6046eb1656d552b0aeab 100644 (file)
@@ -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<uint64_t>& p = block_all[id];
     for (interval_set<uint64_t>::iterator q = p.begin(); q != p.end(); ++q) {
       alloc[id]->init_add_free(q.get_start(), q.get_len());
index 49c0500bae09146cc522e6e7154142451ca3da53..7c24a433f002e8e3d67dbb1535d22621070dd8a4 100644 (file)
@@ -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;