]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: allow default to buffered write 11301/head
authorSage Weil <sage@redhat.com>
Fri, 7 Oct 2016 20:07:53 +0000 (16:07 -0400)
committerSage Weil <sage@redhat.com>
Fri, 7 Oct 2016 20:07:59 +0000 (16:07 -0400)
Add config option to buffered writes (in the absense of
a client WILLNEED hint).  Set the config option to false,
though, so that the default behavior is unchanged.

2Q should do a half-decent job of preventing this from
pushing actually-hot data from the cache when it's
enabled, but we'll need to do more testing first.

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

index 312b8edf36bab5de5c1fa3ede97fa36141ca2ea2..32f3e813d4d3491c7376edf975d17eedcdc52994 100644 (file)
@@ -1020,6 +1020,7 @@ OPTION(bluestore_overlay_max_length, OPT_INT, 65536)
 OPTION(bluestore_overlay_max, OPT_INT, 0)
 OPTION(bluestore_clone_cow, OPT_BOOL, false)  // do copy-on-write for clones
 OPTION(bluestore_default_buffered_read, OPT_BOOL, true)
+OPTION(bluestore_default_buffered_write, OPT_BOOL, false)
 OPTION(bluestore_debug_misc, OPT_BOOL, false)
 OPTION(bluestore_debug_no_reuse_blocks, OPT_BOOL, false)
 OPTION(bluestore_debug_small_allocations, OPT_INT, 0)
index ce673dab018bc364352c765b2df9e481eb976e94..8bfd72c369050771aff11803c6d7de48a3837d7e 100644 (file)
@@ -7845,6 +7845,11 @@ int BlueStore::_do_write(
   if (fadvise_flags & CEPH_OSD_OP_FLAG_FADVISE_WILLNEED) {
     dout(20) << __func__ << " will do buffered write" << dendl;
     wctx.buffered = true;
+  } else if (g_conf->bluestore_default_buffered_write &&
+            (fadvise_flags & (CEPH_OSD_OP_FLAG_FADVISE_DONTNEED |
+                              CEPH_OSD_OP_FLAG_FADVISE_NOCACHE)) == 0) {
+    dout(20) << __func__ << " defaulting to buffered write" << dendl;
+    wctx.buffered = true;
   }
 
   // FIXME: Using the MAX of the block_size_order and preferred_csum_order
index 9ecb663da0b7b7ca91ec3a27f44e0d0887ad8287..321a0d607adef512e3dc7fa6a68f065cec4026d2 100644 (file)
@@ -4207,6 +4207,8 @@ TEST_P(StoreTest, SyntheticMatrixSharding) {
     { "bluestore_extent_map_shard_min_size", "60", 0 },
     { "bluestore_extent_map_shard_max_size", "300", 0 },
     { "bluestore_extent_map_shard_target_size", "150", 0 },
+    { "bluestore_default_buffered_read", "true", 0 },
+    { "bluestore_default_buffered_write", "true", 0 },
     { 0 },
   };
   do_matrix(m, store);
@@ -4272,6 +4274,7 @@ TEST_P(StoreTest, SyntheticMatrixCsumAlgorithm) {
     { "bluestore_min_alloc_size", "65536", 0 },
     { "bluestore_csum_type", "crc32c", "crc32c_16", "crc32c_8", "xxhash32",
       "xxhash64", "none", 0 },
+    { "bluestore_default_buffered_write", "false", 0 },
     { 0 },
   };
   do_matrix(m, store);
@@ -4290,6 +4293,7 @@ TEST_P(StoreTest, SyntheticMatrixCsumVsCompression) {
     { "bluestore_compression_algorithm", "snappy", "zlib", 0 },
     { "bluestore_csum_type", "crc32c", 0 },
     { "bluestore_default_buffered_read", "true", "false", 0 },
+    { "bluestore_default_buffered_write", "true", "false", 0 },
     { 0 },
   };
   do_matrix(m, store);
@@ -4305,6 +4309,7 @@ TEST_P(StoreTest, SyntheticMatrixCompression) {
     { "alignment", "65536", 0 },
     { "bluestore_min_alloc_size", "4096", "65536", 0 },
     { "bluestore_compression", "force", "aggressive", "passive", "none", 0},
+    { "bluestore_default_buffered_write", "false", 0 },
     { 0 },
   };
   do_matrix(m, store);
@@ -4320,6 +4325,7 @@ TEST_P(StoreTest, SyntheticMatrixCompressionAlgorithm) {
     { "alignment", "65536", 0 },
     { "bluestore_compression_algorithm", "zlib", "snappy", 0 },
     { "bluestore_compression", "force", 0 },
+    { "bluestore_default_buffered_write", "false", 0 },
     { 0 },
   };
   do_matrix(m, store);
@@ -4338,6 +4344,7 @@ TEST_P(StoreTest, SyntheticMatrixNoCsum) {
     { "bluestore_compression", "force", "none", 0},
     { "bluestore_csum_type", "none", 0},
     { "bluestore_default_buffered_read", "true", "false", 0 },
+    { "bluestore_default_buffered_write", "true", 0 },
     { 0 },
   };
   do_matrix(m, store);