]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: introduce bluestore_max_blob_size
authorSage Weil <sage@redhat.com>
Tue, 27 Sep 2016 16:26:13 +0000 (12:26 -0400)
committerSage Weil <sage@redhat.com>
Fri, 30 Sep 2016 17:47:22 +0000 (13:47 -0400)
This is enforced for compressed and non-compressed blobs alike.
We keep the separate compressoin min and max tunables since these
may be adjusted on a per-pool basis as well.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/test/objectstore/store_test.cc

index 144f50ee192ff6027ece12c0e6125b736156085e..a96b8b30044e09558711cbd150e60902d12ed70d 100644 (file)
@@ -975,6 +975,7 @@ OPTION(bluestore_compression, OPT_STR, "none")  // force|aggressive|passive|none
 OPTION(bluestore_compression_algorithm, OPT_STR, "snappy")
 OPTION(bluestore_compression_min_blob_size, OPT_U32, 128*1024)
 OPTION(bluestore_compression_max_blob_size, OPT_U32, 512*1024)
+OPTION(bluestore_max_blob_size, OPT_U32, 512*1024)
 OPTION(bluestore_gc_max_blob_depth, OPT_U32, 3)
 OPTION(bluestore_gc_merge_data, OPT_BOOL, true)
 /*
index 7e4785ebd31157c2e999a5cd93d8c2f97993cf00..307433409e4549b313463ccc7fc895a5e3122700 100644 (file)
@@ -7267,17 +7267,13 @@ void BlueStore::_do_write_big(
     bufferlist::iterator& blp,
     WriteContext *wctx)
 {
-  uint64_t max_blob_len = length;
-  if (wctx->compress) {
-    max_blob_len = MIN(length, wctx->comp_blob_size);
-  }
   dout(10) << __func__ << " 0x" << std::hex << offset << "~" << length
-          << " max_blob_len 0x" << max_blob_len
+          << " target_blob_size 0x" << wctx->target_blob_size
           << " compress " << (int)wctx->compress
           << std::dec << dendl;
   while (length > 0) {
     BlobRef b = c->new_blob();
-    auto l = MIN(max_blob_len, length);
+    auto l = MIN(wctx->target_blob_size, length);
     bufferlist t;
     blp.copy(l, t);
     _buffer_cache_write(txc, b, 0, t, wctx->buffered ? 0 : Buffer::FLAG_NOCACHE);
@@ -7678,13 +7674,22 @@ 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;
-    wctx.comp_blob_size = comp_max_blob_size.load();
     wctx.csum_order = min_alloc_size_order;
+    if (wctx.compress) {
+      wctx.target_blob_size = comp_max_blob_size.load();
+    }
   } else {
-    wctx.comp_blob_size = comp_min_blob_size.load();
+    if (wctx.compress) {
+      wctx.target_blob_size = comp_min_blob_size.load();
+    }
   }
+  if (wctx.target_blob_size == 0 ||
+      wctx.target_blob_size > g_conf->bluestore_max_blob_size) {
+    wctx.target_blob_size = g_conf->bluestore_max_blob_size;
+  }
+
   dout(20) << __func__ << " prefer csum_order " << wctx.csum_order
-          << " comp_blob_size 0x" << std::hex << wctx.comp_blob_size
+          << " target_blob_size 0x" << std::hex << wctx.target_blob_size
           << std::dec << dendl;
 
   uint64_t gc_start_offset = offset, gc_end_offset = end;
index 16b59ed12ff6950c93e3ea8bd0c8753702e4f7df..46c0f9db0fa4a1244e26e94cf834ca92029b7ebe 100644 (file)
@@ -1721,11 +1721,11 @@ private:
   // write ops
 
   struct WriteContext {
-    bool buffered = false;       ///< buffered write
-    bool compress = false;       ///< compressed write
-    uint64_t comp_blob_size = 0; ///< target compressed blob size
-    uint8_t blob_depth = 0;       ///< depth of the logical extent
-    unsigned csum_order = 0;     ///< target checksum chunk order
+    bool buffered = false;          ///< buffered write
+    bool compress = false;          ///< compressed write
+    uint64_t target_blob_size = 0;  ///< target (max) blob size
+    uint8_t blob_depth = 0;         ///< depth of the logical extent
+    unsigned csum_order = 0;        ///< target checksum chunk order
 
     extent_map_t old_extents;       ///< must deref these blobs
 
index c8d8dcf41eb9f99abae408019ecea43a5441b954..80df222d861ec57783e68fe3750b2fae87d2963e 100644 (file)
@@ -4180,6 +4180,7 @@ TEST_P(StoreTest, SyntheticMatrixSharding) {
     { "max_size", "262144", 0 },
     { "alignment", "4096", 0 },
     { "bluestore_min_alloc_size", "4096", 0 },
+    { "bluestore_max_blob_size", "65536", 0 },
     { "bluestore_extent_map_shard_min_size", "60", 0 },
     { "bluestore_extent_map_shard_max_size", "300", 0 },
     { "bluestore_extent_map_shard_target_size", "150", 0 },
@@ -4309,6 +4310,7 @@ TEST_P(StoreTest, SyntheticMatrixNoCsum) {
     { "max_size", "1048576", 0 },
     { "alignment", "512", 0 },
     { "bluestore_min_alloc_size", "65536", "4096", 0 },
+    { "bluestore_max_blob_size", "262144", 0 },
     { "bluestore_compression", "force", "none", 0},
     { "bluestore_csum_type", "none", 0},
     { "bluestore_default_buffered_read", "true", "false", 0 },