Skip to content

Commit

Permalink
os/bluestore: allow default to buffered write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
liewegas committed Oct 7, 2016
1 parent b675f34 commit 7ae800b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/test/objectstore/store_test.cc
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 7ae800b

Please sign in to comment.