Skip to content

Commit

Permalink
Merge pull request #12464 from ifed01/wip-bluestore-turnoff-block-write
Browse files Browse the repository at this point in the history
os/bluestore: add a debug option to bypass block device writes for bl…

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Dec 22, 2016
2 parents 6c889cf + f80022d commit 7a15752
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ OPTION(bluestore_debug_prefill, OPT_FLOAT, 0)
OPTION(bluestore_debug_prefragment_max, OPT_INT, 1048576)
OPTION(bluestore_debug_inject_read_err, OPT_BOOL, false)
OPTION(bluestore_debug_randomize_serial_transaction, OPT_INT, 0)
OPTION(bluestore_debug_omit_block_device_write, OPT_BOOL, false)
OPTION(bluestore_inject_wal_apply_delay, OPT_FLOAT, 0)
OPTION(bluestore_shard_finishers, OPT_BOOL, false)

Expand Down
32 changes: 19 additions & 13 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6875,8 +6875,10 @@ int BlueStore::_do_wal_op(TransContext *txc, bluestore_wal_op_t& wo)
for (auto& e : wo.extents) {
bufferlist bl;
p.copy(e.length, bl);
int r = bdev->aio_write(e.offset, bl, &txc->ioc, false);
assert(r == 0);
if (!g_conf->bluestore_debug_omit_block_device_write) {
int r = bdev->aio_write(e.offset, bl, &txc->ioc, false);
assert(r == 0);
}
}
}
break;
Expand Down Expand Up @@ -7632,12 +7634,14 @@ void BlueStore::_do_write_small(
_buffer_cache_write(txc, b, b_off, padded,
wctx->buffered ? 0 : Buffer::FLAG_NOCACHE);

b->get_blob().map_bl(
b_off, padded,
[&](uint64_t offset, uint64_t length, bufferlist& t) {
bdev->aio_write(offset, t,
&txc->ioc, wctx->buffered);
});
if (!g_conf->bluestore_debug_omit_block_device_write) {
b->get_blob().map_bl(
b_off, padded,
[&](uint64_t offset, uint64_t length, 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;
Extent *le = o->extent_map.set_lextent(offset, b_off + head_pad, length,
Expand Down Expand Up @@ -7956,11 +7960,13 @@ int BlueStore::_do_alloc_write(
}

// queue io
b->get_blob().map_bl(
b_off, *l,
[&](uint64_t offset, uint64_t length, bufferlist& t) {
bdev->aio_write(offset, t, &txc->ioc, false);
});
if (!g_conf->bluestore_debug_omit_block_device_write) {
b->get_blob().map_bl(
b_off, *l,
[&](uint64_t offset, uint64_t length, bufferlist& t) {
bdev->aio_write(offset, t, &txc->ioc, false);
});
}
}
if (need > 0) {
alloc->unreserve(need);
Expand Down

0 comments on commit 7a15752

Please sign in to comment.