]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: min_alloc_size options for different media types
authorRamesh Chander <Ramesh.Chander@sandisk.com>
Fri, 20 May 2016 17:05:15 +0000 (10:05 -0700)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:40:47 +0000 (11:40 -0400)
Signed-off-by: Ramesh Chander <Ramesh.Chander@sandisk.com>
src/common/config_opts.h
src/os/bluestore/BlockDevice.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/KernelDevice.cc

index a3ee4647d858710c2604fb027a0b86d9b1538ff8..6d4fa06167df425478eba821647551a73f525059 100644 (file)
@@ -953,7 +953,9 @@ OPTION(bluestore_csum, OPT_BOOL, true)
 OPTION(bluestore_csum_type, OPT_STR, "crc32c")
 OPTION(bluestore_min_csum_block, OPT_U32, 4096)
 OPTION(bluestore_max_csum_block, OPT_U32, 64*1024)
-OPTION(bluestore_min_alloc_size, OPT_U32, 64*1024)
+OPTION(bluestore_min_alloc_size, OPT_U32, 0)
+OPTION(bluestore_min_alloc_size_hdd, OPT_U32, 64*1024)
+OPTION(bluestore_min_alloc_size_ssd, OPT_U32, 4*1024)
 OPTION(bluestore_onode_map_size, OPT_U32, 1024)   // onodes per collection
 OPTION(bluestore_cache_tails, OPT_BOOL, true)   // cache tail blocks in Onode
 OPTION(bluestore_kvbackend, OPT_STR, "rocksdb")
index 14608ebcca805ce08763f895547cf76945274458..07380d8634eb3a78706003846bddca872c18c5d8 100644 (file)
@@ -72,8 +72,11 @@ class BlockDevice {
   std::mutex ioc_reap_lock;
   vector<IOContext*> ioc_reap_queue;
   std::atomic_int ioc_reap_count = {0};
-public:
+
+protected:
   bool rotational;
+
+public:
   BlockDevice() = default;
   virtual ~BlockDevice() = default;
   typedef void (*aio_callback_t)(void *handle, void *aio);
@@ -82,6 +85,7 @@ public:
       const string& path, aio_callback_t cb, void *cbpriv);
   virtual bool supported_bdev_label() { return true; }
   virtual bool is_rotational() { return rotational; }
+
   virtual void aio_submit(IOContext *ioc) = 0;
 
   virtual uint64_t get_size() const = 0;
index 5f86630948c24bbccc120cfb6761ab2567eddce5..15cac81c050f3b510181e1106681f4a7b9f603cb 100644 (file)
@@ -771,7 +771,7 @@ BlueStore::BlueStore(CephContext *cct, const string& path)
     kv_stop(false),
     logger(NULL),
     csum_type(bluestore_blob_t::CSUM_CRC32C),
-    min_alloc_size(g_conf->bluestore_min_alloc_size)
+    min_alloc_size(0)
 {
   _init_logger();
 }
@@ -790,7 +790,6 @@ 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,11 +809,6 @@ 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;
-    dout(10) << __func__ << " min_alloc_size 0x" << std::hex << min_alloc_size
-            << std::dec << dendl;
-  }
 }
 
 void BlueStore::_init_logger()
@@ -969,6 +963,26 @@ int BlueStore::_check_or_set_bdev_label(
   return 0;
 }
 
+void BlueStore::_set_min_alloc(void)
+{
+  /*
+   * Set device block size according to its media
+   */
+  if (g_conf->bluestore_min_alloc_size) {
+    min_alloc_size = g_conf->bluestore_min_alloc_size;
+  } else {
+    assert(bdev);
+    if (bdev->is_rotational()) {
+      min_alloc_size = g_conf->bluestore_min_alloc_size_hdd;
+    } else {
+      min_alloc_size = g_conf->bluestore_min_alloc_size_ssd;
+    }
+  }
+
+  dout(10) << __func__ << " min_alloc_size 0x" << std::hex << min_alloc_size
+          << std::dec << dendl;
+}
+
 int BlueStore::_open_bdev(bool create)
 {
   bluestore_bdev_label_t label;
@@ -992,6 +1006,8 @@ int BlueStore::_open_bdev(bool create)
   for (uint64_t t = 1; t < block_size; t <<= 1) {
     ++block_size_order;
   }
+
+  _set_min_alloc();
   return 0;
 
  fail_close:
index 736c9c0a24212a14a46b29cc7579655fe0780ea7..0525e2ac2b5170e9d088114a6f72a4fa7efe21a6 100644 (file)
@@ -900,6 +900,7 @@ private:
   int _read_fsid(uuid_d *f);
   int _write_fsid();
   void _close_fsid();
+  void _set_min_alloc();
   int _open_bdev(bool create);
   void _close_bdev();
   int _open_db(bool create);
index a61d3615eecaea8ea476826ef40102cf5622d380..09dc7bc8f69f0ad586939e44b18dd31cf258db08 100644 (file)
@@ -46,6 +46,7 @@ KernelDevice::KernelDevice(aio_callback_t cb, void *cbpriv)
 {
   zeros = buffer::create_page_aligned(1048576);
   zeros.zero();
+  rotational = true;
 }
 
 int KernelDevice::_lock()