]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make dynamically loadable config parameters atomic
authorIgor Fedotov <ifedotov@mirantis.com>
Mon, 10 Apr 2017 13:55:39 +0000 (13:55 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Mon, 17 Apr 2017 12:03:28 +0000 (05:03 -0700)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 95db56acced7b8985380f97ceb37bcff1560ecc7..e9468af610d5edc4662b0514325e7e9fd19dfc90 100644 (file)
@@ -7259,9 +7259,10 @@ void BlueStore::_txc_calc_cost(TransContext *txc)
   for (auto& p : txc->ioc.pending_aios) {
     ios += p.iov.size();
   }
-  txc->cost = ios * throttle_cost_per_io + txc->bytes;
+  auto cost = throttle_cost_per_io.load();
+  txc->cost = ios * cost + txc->bytes;
   dout(10) << __func__ << " " << txc << " cost " << txc->cost << " ("
-          << ios << " ios * " << throttle_cost_per_io << " + " << txc->bytes
+          << ios << " ios * " << cost << " + " << txc->bytes
           << " bytes)" << dendl;
 }
 
@@ -9353,8 +9354,9 @@ int BlueStore::_do_alloc_write(
 
     AllocExtentVector extents;
     extents.reserve(4);  // 4 should be (more than) enough for most allocations
-    int64_t got = alloc->allocate(final_length, min_alloc_size, max_alloc_size,
-                            hint, &extents);
+    int64_t got = alloc->allocate(final_length, min_alloc_size, 
+                                 max_alloc_size.load(),
+                                 hint, &extents);
     assert(got == (int64_t)final_length);
     need -= got;
     txc->statfs_delta.allocated() += got;
@@ -9400,7 +9402,7 @@ int BlueStore::_do_alloc_write(
 
     // queue io
     if (!g_conf->bluestore_debug_omit_block_device_write) {
-      if (l->length() <= prefer_deferred_size) {
+      if (l->length() <= prefer_deferred_size.load()) {
        dout(20) << __func__ << " deferring small 0x" << std::hex
                 << l->length() << std::dec << " write via deferred" << dendl;
        bluestore_deferred_op_t *op = _get_deferred_op(txc, o);
@@ -9605,11 +9607,12 @@ int BlueStore::_do_write(
                        CEPH_OSD_ALLOC_HINT_FLAG_APPEND_ONLY)) &&
       (alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_RANDOM_WRITE) == 0) {
     dout(20) << __func__ << " will prefer large blob and csum sizes" << dendl;
+    auto order = min_alloc_size_order.load();
     if (o->onode.expected_write_size) {
-      wctx.csum_order = std::max(min_alloc_size_order,
+      wctx.csum_order = std::max(order,
                                 (size_t)ctzl(o->onode.expected_write_size));
     } else {
-      wctx.csum_order = min_alloc_size_order;
+      wctx.csum_order = order;
     }
 
     if (wctx.compress) {
index 00e79b9902d3ac371a4fa1e324d8b880f2f25167..77028ecdbadbd5e04c5736eec074130e8f648e6d 100644 (file)
@@ -1790,13 +1790,19 @@ private:
   size_t block_size_order = 0; ///< bits to shift to get block size
 
   uint64_t min_alloc_size = 0; ///< minimum allocation unit (power of 2)
-  size_t min_alloc_size_order = 0; ///< bits for min_alloc_size
-  uint64_t prefer_deferred_size = 0; ///< size threshold for forced deferred writes
   int deferred_batch_ops = 0; ///< deferred batch size
 
-  uint64_t max_alloc_size = 0; ///< maximum allocation unit (power of 2)
+  ///< bits for min_alloc_size
+  std::atomic<size_t> min_alloc_size_order = {0};
+  
+  ///< size threshold for forced deferred writes
+  std::atomic<uint64_t> prefer_deferred_size = {0};
 
-  uint64_t throttle_cost_per_io = 0;   ///< approx cost per io, in bytes
+  ///< maximum allocation unit (power of 2)
+  std::atomic<uint64_t> max_alloc_size = {0};
+
+  ///< approx cost per io, in bytes
+  std::atomic<uint64_t> throttle_cost_per_io = {0};
 
   std::atomic<Compressor::CompressionMode> comp_mode = {Compressor::COMP_NONE}; ///< compression mode
   CompressorRef compressor;