]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: define min_alloc_size globally
authorSage Weil <sage@redhat.com>
Thu, 12 May 2016 17:31:09 +0000 (13:31 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:47 +0000 (11:38 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index ac7af67a03358cbf3475c67eccfe993514c73a50..77cbf1c83386722b6e4e677736b25fcb65a59986 100644 (file)
@@ -791,6 +791,7 @@ const char **BlueStore::get_tracked_conf_keys() const
   static const char* KEYS[] = {
     "bluestore_csum",
     "bluestore_csum_type",
+    "bluestore_min_alloc_size",
     NULL
   };
   return KEYS;
@@ -810,6 +811,9 @@ void BlueStore::handle_conf_change(const struct md_config_t *conf,
             << bluestore_blob_t::get_csum_type_string(csum_type)
             << dendl;
   }
+  if (changed.count("bluestore_min_alloc_size")) {
+    min_alloc_size = g_conf->bluestore_min_alloc_size;
+  }
 }
 
 void BlueStore::_init_logger()
@@ -984,7 +988,7 @@ int BlueStore::_open_bdev(bool create)
   block_size = bdev->get_block_size();
   block_mask = ~(block_size - 1);
   block_size_order = 0;
-  for (uint64_t t = 1; t < block_size; ++t) {
+  for (uint64_t t = 1; t < block_size; t <<= 1) {
     ++block_size_order;
   }
   return 0;
index b54f3f8bc099080589d67a28ed919e2671951a16..f46fb9435a74efb0b49aa9f64c30c2b11ef77330 100644 (file)
@@ -598,6 +598,8 @@ private:
   uint64_t block_mask;     ///< mask to get just the block offset
   size_t block_size_order; ///< bits to shift to get block size
 
+  uint64_t min_alloc_size; ///< minimum allocation unit (power of 2)
+
   // --------------------------------------------------------
   // private methods