]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: turn bluestore zero block detection off by default
authorLaura Flores <lflores@redhat.com>
Fri, 6 May 2022 17:14:10 +0000 (17:14 +0000)
committerLaura Flores <lflores@redhat.com>
Tue, 31 May 2022 22:59:44 +0000 (22:59 +0000)
This commit adds a new global config option called `bluestore_zero_block_detection`.
This option is used at a dev level to skip zero bufferlist writes in large-scale
testing scenarios.

Store tests originally written for the BlueStore zero block detection feature
now account for the global config option; these tests will only run if
`bluestore_zero_block_detection` is set to "true".

Fixes: https://tracker.ceph.com/issues/55521
Signed-off-by: Laura Flores <lflores@redhat.com>
(cherry picked from commit 4a8180952c292aa2f8ee656685fcdddc3f0f0a4f)

src/common/options/global.yaml.in
src/os/bluestore/BlueStore.cc
src/test/objectstore/store_test.cc

index 1e9fd067f4c48435af33ec7e9d42a2cac70bb62e..3bba588296951c7002032366f8dcc5f4f5b74888 100644 (file)
@@ -5418,6 +5418,17 @@ options:
   flags:
   - runtime
   with_legacy: true
+- name: bluestore_zero_block_detection
+  type: bool
+  level: dev
+  desc: punch holes instead of writing zeros
+  long_desc: Intended for large-scale synthetic testing. Currently this is implemented
+    with punch hole semantics, affecting the logical extent map of the object. This does
+    not interact well with some RBD and CephFS features.
+  default: false
+  flags:
+  - runtime
+  with_legacy: true
 - name: kstore_max_ops
   type: uint
   level: advanced
index ce066fa72952b47501904bcae44eadeae4962e01..f3a4f76ecdb9be02ee3fd4c5b4cd6cae1cb62e2f 100644 (file)
@@ -14581,7 +14581,7 @@ void BlueStore::_do_write_small(
     o->extent_map.punch_hole(c, offset, length, &wctx->old_extents);
 
     // Zero detection -- small block
-    if (!bl.is_zero()) {
+    if (!cct->_conf->bluestore_zero_block_detection || !bl.is_zero()) {
       BlobRef b = c->new_blob();
       _pad_zeros(&bl, &b_off0, min_alloc_size);
       wctx->write(offset, b, alloc_len, b_off0, bl, b_off, length, false, true);
@@ -14820,7 +14820,7 @@ void BlueStore::_do_write_small(
            o->extent_map.punch_hole(c, offset, length, &wctx->old_extents);
 
            // Zero detection -- small block
-           if (!bl.is_zero()) {
+           if (!cct->_conf->bluestore_zero_block_detection || !bl.is_zero()) {
              _pad_zeros(&bl, &b_off0, chunk_size);
 
              dout(20) << __func__ << " reuse blob " << *b << std::hex
@@ -14882,7 +14882,7 @@ void BlueStore::_do_write_small(
          o->extent_map.punch_hole(c, offset, length, &wctx->old_extents);
 
          // Zero detection -- small block
-         if (!bl.is_zero()) {
+         if (!cct->_conf->bluestore_zero_block_detection || !bl.is_zero()) {
            uint64_t chunk_size = b->get_blob().get_chunk_size(block_size);
            _pad_zeros(&bl, &b_off0, chunk_size);
 
@@ -14938,7 +14938,7 @@ void BlueStore::_do_write_small(
   o->extent_map.punch_hole(c, offset, length, &wctx->old_extents);
 
   // Zero detection -- small block
-  if (!bl.is_zero()) {
+  if (!cct->_conf->bluestore_zero_block_detection || !bl.is_zero()) {
     // new blob.
     BlobRef b = c->new_blob();
     _pad_zeros(&bl, &b_off0, block_size);
@@ -15271,7 +15271,7 @@ void BlueStore::_do_write_big(
     blp.copy(l, t);
 
     // Zero detection -- big block
-    if (!t.is_zero()) {
+    if (!cct->_conf->bluestore_zero_block_detection || !t.is_zero()) {
       wctx->write(offset, b, l, b_off, t, b_off, l, false, new_blob);
 
       dout(20) << __func__ << " schedule write big: 0x"
index 64e6e60c0cdee5cae31c443107d0272d685a6bd2..e45d5543a108ce54da41adba587b0298ed65fd87 100644 (file)
@@ -7259,8 +7259,9 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwrite) {
 }
 
 TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallAppend) {
-  if (string(GetParam()) != "bluestore") {
-    return;
+  CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
+  if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {
+    GTEST_SKIP() << "not bluestore or bluestore_zero_block_detection=false, skipping";
   }
 
   size_t block_size = 65536;
@@ -7334,8 +7335,9 @@ TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallAppend) {
 }
 
 TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallOverwrite) {
-  if (string(GetParam()) != "bluestore") {
-    return;
+  CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
+  if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {
+    GTEST_SKIP() << "not bluestore or bluestore_zero_block_detection=false, skipping";
   }
   if (smr) {
     cout << "SKIP" << std::endl;
@@ -7435,8 +7437,9 @@ TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallOverwrite) {
 }
 
 TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionBigAppend) {
-  if (string(GetParam()) != "bluestore") {
-    return;
+  CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
+  if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {
+    GTEST_SKIP() << "not bluestore or bluestore_zero_block_detection=false, skipping";
   }
 
   size_t block_size = 4096;
@@ -7513,8 +7516,9 @@ TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionBigAppend) {
 }
 
 TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionBigOverwrite) {
-  if (string(GetParam()) != "bluestore") {
-    return;
+  CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
+  if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {
+    GTEST_SKIP() << "not bluestore or bluestore_zero_block_detection=false, skipping";
   }
   if (smr) {
     cout << "SKIP" << std::endl;