]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make bluestore_max_blob_size parameter hdd/ssd dependant.
authorIgor Fedotov <ifedotov@mirantis.com>
Mon, 10 Apr 2017 13:01:18 +0000 (13:01 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Mon, 17 Apr 2017 12:03:27 +0000 (05:03 -0700)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/test/objectstore/store_test.cc

index 001ac55a9426e88ab1e75ce21fe507b0284d779d..e2a104cbdcff18426eb99578d41068dacad003a5 100644 (file)
@@ -1079,7 +1079,9 @@ OPTION(bluestore_gc_enable_blob_threshold, OPT_INT, 0)
  */
 OPTION(bluestore_gc_enable_total_threshold, OPT_INT, 0)  
 
-OPTION(bluestore_max_blob_size, OPT_U32, 512*1024)
+OPTION(bluestore_max_blob_size, OPT_U32, 0)
+OPTION(bluestore_max_blob_size_hdd, OPT_U32, 512*1024)
+OPTION(bluestore_max_blob_size_ssd, OPT_U32, 64*1024)
 /*
  * Require the net gain of compression at least to be at this ratio,
  * otherwise we don't compress.
index 246db5bc0b0ee1902d25834e21c07f38fd1a43db..95db56acced7b8985380f97ceb37bcff1560ecc7 100644 (file)
@@ -3263,6 +3263,9 @@ const char **BlueStore::get_tracked_conf_keys() const
     "bluestore_max_bytes",
     "bluestore_deferred_max_ops",
     "bluestore_deferred_max_bytes",
+    "bluestore_max_blob_size",
+    "bluestore_max_blob_size_ssd",
+    "bluestore_max_blob_size_hdd",
     NULL
   };
   return KEYS;
@@ -3282,6 +3285,14 @@ void BlueStore::handle_conf_change(const struct md_config_t *conf,
       _set_compression();
     }
   }
+  if (changed.count("bluestore_max_blob_size") ||
+      changed.count("bluestore_max_blob_size_ssd") ||
+      changed.count("bluestore_max_blob_size_hdd")) {
+    if (bdev) {
+      // only after startup
+      _set_blob_size();
+    }
+  }
   if (changed.count("bluestore_prefer_deferred_size") ||
       changed.count("bluestore_max_alloc_size") ||
       changed.count("bluestore_deferred_batch_ops") ||
@@ -3389,6 +3400,21 @@ void BlueStore::_set_throttle_params()
   dout(10) << __func__ << " throttle_cost_per_io " << throttle_cost_per_io
           << dendl;
 }
+void BlueStore::_set_blob_size()
+{
+  if (cct->_conf->bluestore_max_blob_size) {
+    max_blob_size = cct->_conf->bluestore_max_blob_size;
+  } else {
+    assert(bdev);
+    if (bdev->is_rotational()) {
+      max_blob_size = cct->_conf->bluestore_max_blob_size_hdd;
+    } else {
+      max_blob_size = cct->_conf->bluestore_max_blob_size_ssd;
+    }
+  }
+  dout(10) << __func__ << " max_blob_size 0x" << std::hex << max_blob_size
+           << std::dec << dendl;
+}
 
 void BlueStore::_init_logger()
 {
@@ -4875,6 +4901,7 @@ int BlueStore::mount()
 
   _set_csum();
   _set_compression();
+  _set_blob_size();
 
   mounted = true;
   return 0;
@@ -9613,9 +9640,9 @@ int BlueStore::_do_write(
       );
     }
   }
-  if (wctx.target_blob_size == 0 ||
-      wctx.target_blob_size > cct->_conf->bluestore_max_blob_size) {
-    wctx.target_blob_size = cct->_conf->bluestore_max_blob_size;
+  uint64_t max_bsize = max_blob_size.load();
+  if (wctx.target_blob_size == 0 || wctx.target_blob_size > max_bsize) {
+    wctx.target_blob_size = max_bsize;
   }
   // set the min blob size floor at 2x the min_alloc_size, or else we
   // won't be able to allocate a smaller extent for the compressed
index 0f79784f061e1758db95156b0d06203dddc1d149..00e79b9902d3ac371a4fa1e324d8b880f2f25167 100644 (file)
@@ -1803,6 +1803,8 @@ private:
   std::atomic<uint64_t> comp_min_blob_size = {0};
   std::atomic<uint64_t> comp_max_blob_size = {0};
 
+  std::atomic<uint64_t> max_blob_size = {0};  ///< maximum blob size
+
   // cache trim control
 
   // note that these update in a racy way, but we don't *really* care if
@@ -1856,6 +1858,8 @@ private:
   int _write_fsid();
   void _close_fsid();
   void _set_alloc_sizes();
+  void _set_blob_size();
+
   int _open_bdev(bool create);
   void _close_bdev();
   int _open_db(bool create);
index 98e4438093cfaceef598d565126fcac7bafb2ed0..a278866619e451e59aa27977371cbe55379d37a5 100644 (file)
@@ -5988,7 +5988,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwrite) {
     r = apply_transaction(store, &osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
-  g_conf->set_val("bluestore_max_blob_size", "524288");
+  g_conf->set_val("bluestore_max_blob_size", "0");
 
 }
 
@@ -6171,7 +6171,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwriteReverse) {
     r = apply_transaction(store, &osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
-  g_conf->set_val("bluestore_max_blob_size", "524288");
+  g_conf->set_val("bluestore_max_blob_size", "0");
 }
 
 TEST_P(StoreTestSpecificAUSize, BlobReuseOnSmallOverwrite) {
@@ -6245,7 +6245,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnSmallOverwrite) {
     r = apply_transaction(store, &osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
-  g_conf->set_val("bluestore_max_blob_size", "524288");
+  g_conf->set_val("bluestore_max_blob_size", "0");
 }
 
 // The test case to reproduce an issue when write happens