OPTION(bluestore_min_alloc_size_hdd, OPT_U32, 64*1024)
OPTION(bluestore_min_alloc_size_ssd, OPT_U32, 4*1024)
OPTION(bluestore_max_alloc_size, OPT_U32, 0)
+OPTION(bluestore_prefer_wal_size, OPT_U32, 0)
+OPTION(bluestore_prefer_wal_size_hdd, OPT_U32, 32768)
+OPTION(bluestore_prefer_wal_size_ssd, OPT_U32, 0)
OPTION(bluestore_compression_mode, OPT_STR, "none") // force|aggressive|passive|none
OPTION(bluestore_compression_algorithm, OPT_STR, "snappy")
OPTION(bluestore_compression_min_blob_size, OPT_U32, 128*1024)
"bluestore_compression_algorithm",
"bluestore_compression_min_blob_size",
"bluestore_compression_max_blob_size",
+ "bluestore_max_alloc_size",
+ "bluestore_prefer_wal_size",
NULL
};
return KEYS;
changed.count("bluestore_compression_max_blob_size")) {
_set_compression();
}
+ if (changed.count("bluestore_prefer_wal_size") ||
+ changed.count("bluestore_max_alloc_size")) {
+ if (bdev) {
+ // only after startup
+ _set_alloc_sizes();
+ }
+ }
}
void BlueStore::_set_compression()
max_alloc_size = cct->_conf->bluestore_max_alloc_size;
+ if (cct->_conf->bluestore_prefer_wal_size) {
+ prefer_wal_size = cct->_conf->bluestore_prefer_wal_size;
+ } else {
+ assert(bdev);
+ if (bdev->is_rotational()) {
+ prefer_wal_size = cct->_conf->bluestore_prefer_wal_size_hdd;
+ } else {
+ prefer_wal_size = cct->_conf->bluestore_prefer_wal_size_ssd;
+ }
+ }
+
dout(10) << __func__ << " min_alloc_size 0x" << std::hex << min_alloc_size
<< std::dec << " order " << min_alloc_size_order
<< " max_alloc_size 0x" << std::hex << max_alloc_size
wctx->buffered ? 0 : Buffer::FLAG_NOCACHE);
if (!g_conf->bluestore_debug_omit_block_device_write) {
- b->get_blob().map_bl(
- b_off, padded,
- [&](uint64_t offset, bufferlist& t) {
- bdev->aio_write(offset, t,
- &txc->ioc, wctx->buffered);
- });
+ if (b_len <= prefer_wal_size) {
+ dout(20) << __func__ << " defering small 0x" << std::hex
+ << b_len << std::dec << " unused write via wal" << dendl;
+ bluestore_wal_op_t *op = _get_wal_op(txc, o);
+ op->op = bluestore_wal_op_t::OP_WRITE;
+ b->get_blob().map(
+ b_off, b_len,
+ [&](uint64_t offset, uint64_t length) {
+ op->extents.emplace_back(bluestore_pextent_t(offset, length));
+ return 0;
+ });
+ op->data = padded;
+ } else {
+ b->get_blob().map_bl(
+ b_off, padded,
+ [&](uint64_t offset, bufferlist& t) {
+ bdev->aio_write(offset, t,
+ &txc->ioc, wctx->buffered);
+ });
+ }
}
b->dirty_blob().calc_csum(b_off, padded);
dout(20) << __func__ << " lex old " << *ep << dendl;
int BlueStore::_do_alloc_write(
TransContext *txc,
CollectionRef coll,
+ OnodeRef& o,
WriteContext *wctx)
{
dout(20) << __func__ << " txc " << txc
// queue io
if (!g_conf->bluestore_debug_omit_block_device_write) {
- b->get_blob().map_bl(
- b_off, *l,
- [&](uint64_t offset, bufferlist& t) {
- bdev->aio_write(offset, t, &txc->ioc, false);
- });
+ if (l->length() <= prefer_wal_size) {
+ dout(20) << __func__ << " defering small 0x" << std::hex
+ << l->length() << std::dec << " write via wal" << dendl;
+ bluestore_wal_op_t *op = _get_wal_op(txc, o);
+ op->op = bluestore_wal_op_t::OP_WRITE;
+ b->get_blob().map(
+ b_off, l->length(),
+ [&](uint64_t offset, uint64_t length) {
+ op->extents.emplace_back(bluestore_pextent_t(offset, length));
+ return 0;
+ });
+ op->data = *l;
+ } else {
+ b->get_blob().map_bl(
+ b_off, *l,
+ [&](uint64_t offset, bufferlist& t) {
+ bdev->aio_write(offset, t, &txc->ioc, false);
+ });
+ }
}
}
if (need > 0) {
_do_garbage_collection(txc, c, o, offset, length, &wctx);
- r = _do_alloc_write(txc, c, &wctx);
+ r = _do_alloc_write(txc, c, o, &wctx);
if (r < 0) {
derr << __func__ << " _do_alloc_write failed with " << cpp_strerror(r)
<< dendl;
do_matrix(m, store, doSyntheticTest);
}
+TEST_P(StoreTestSpecificAUSize, SyntheticMatrixPreferWAL) {
+ if (string(GetParam()) != "bluestore")
+ return;
+
+ const char *m[][10] = {
+ { "bluestore_min_alloc_size", "4096", "65536", 0 }, // to be the first!
+ { "max_write", "65536", 0 },
+ { "max_size", "1048576", 0 },
+ { "alignment", "512", 0 },
+ { "bluestore_max_blob_size", "262144", 0 },
+ { "bluestore_compression_mode", "force", "none", 0},
+ { "bluestore_prefer_wal_size", "32768", "0", 0},
+ { "bluestore_sync_wal_apply_hdd", "false", 0},
+ { "bluestore_sync_wal_apply_ssd", "false", 0},
+ { 0 },
+ };
+ do_matrix(m, store, doSyntheticTest);
+}
+
TEST_P(StoreTest, AttrSynthetic) {
ObjectStore::Sequencer osr("test");
MixedGenerator gen(447);