]> 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)
committerSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:07:38 +0000 (18:07 -0400)
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>
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 0a73f61f84eadee901db67debbc33234b8274313..3a53d038f1021656425d5448742055aa131ed890 100644 (file)
@@ -4169,7 +4169,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;