]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/FreelistManager: create: accept min alloc size
authorSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:07:38 +0000 (18:07 -0400)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 30 Sep 2017 00:36:35 +0000 (08:36 +0800)
Accept a block size other than bdev_block_size.  Let's call it, oh, I don't
know, min_alloc_size.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 52453d4ca223c8819f8e35f2c0b691803e74537f)

src/os/bluestore/BitmapFreelistManager.cc
src/os/bluestore/BitmapFreelistManager.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/FreelistManager.h

index 075d3eff6ef18451c6ba04cdd41463ad6cbc0ee6..e551acc52871fb7609f8ae57d3600ddc9482f2c6 100644 (file)
@@ -58,9 +58,11 @@ BitmapFreelistManager::BitmapFreelistManager(CephContext* cct,
 {
 }
 
-int BitmapFreelistManager::create(uint64_t new_size, KeyValueDB::Transaction txn)
+int BitmapFreelistManager::create(uint64_t new_size, uint64_t min_alloc_size,
+                                 KeyValueDB::Transaction txn)
 {
-  bytes_per_block = cct->_conf->bdev_block_size;
+  bytes_per_block = std::max(cct->_conf->bdev_block_size,
+                            (int64_t)min_alloc_size);
   assert(ISP2(bytes_per_block));
   size = P2ALIGN(new_size, bytes_per_block);
   blocks_per_key = cct->_conf->bluestore_freelist_blocks_per_key;
index 9ed39ff56534fd0658ae7305b996be133ddd6a42..cb10c63d98a11ec0bbb9b50eedbc066c7286f4fb 100644 (file)
@@ -51,7 +51,8 @@ public:
 
   static void setup_merge_operator(KeyValueDB *db, string prefix);
 
-  int create(uint64_t size, KeyValueDB::Transaction txn) override;
+  int create(uint64_t size, uint64_t min_alloc_size,
+            KeyValueDB::Transaction txn) override;
 
   int init() override;
   void shutdown() override;
index 88fe1b4e9e5fa8cbe72f5e676a94c9315656ff95..9c2a2fedcd24d9a2e4d7f1e5534740854bf6493c 100644 (file)
@@ -4159,7 +4159,7 @@ int BlueStore::_open_fm(bool create)
       bl.append(freelist_type);
       t->set(PREFIX_SUPER, "freelist_type", bl);
     }
-    fm->create(bdev->get_size(), t);
+    fm->create(bdev->get_size(), cct->_conf->bdev_block_size, t);
 
     // allocate superblock reserved space.  note that we do not mark
     // bluefs space as allocated in the freelist; we instead rely on
index 7f5ad4d79f9b7ab95540d60150ce96f3ff0e9cf6..8f7aacbf2e1f6a1a81ddbd950764d7f1157a3a41 100644 (file)
@@ -24,7 +24,8 @@ public:
 
   static void setup_merge_operators(KeyValueDB *db);
 
-  virtual int create(uint64_t size, KeyValueDB::Transaction txn) = 0;
+  virtual int create(uint64_t size, uint64_t min_alloc_size,
+                    KeyValueDB::Transaction txn) = 0;
 
   virtual int init() = 0;
   virtual void shutdown() = 0;