Skip to content

Commit

Permalink
os/bluestore: Add conf.bluestore_write_v2_random
Browse files Browse the repository at this point in the history
Added conf.bluestore_write_v2_random. This is useful only for testing.
If set, it overrides value of bluestore_write_v2 with a random
true/false selection.
It is useful for v1 / v2 compatibility testing.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
  • Loading branch information
aclamk committed Aug 7, 2024
1 parent 3b5b7fa commit 7de8a6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/common/options/global.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -5053,6 +5053,17 @@ options:
flags:
- startup
with_legacy: false
- name: bluestore_write_v2_random
type: bool
level: advanced
desc: Random selection of write path mode
long_desc: For testing purposes. If true, value of bluestore_write_v2 is randomly selected.
default: false
see_also:
- bluestore_write_v2
flags:
- startup
with_legacy: false
- name: bluestore_allocator
type: str
level: advanced
Expand Down
7 changes: 6 additions & 1 deletion src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9149,7 +9149,12 @@ int BlueStore::_mount()
return r;
}
}
use_write_v2 = cct->_conf.get_val<bool>("bluestore_write_v2");
use_write_v2 = cct->_conf.get_val<bool>("bluestore_write_v2");
if (cct->_conf.get_val<bool>("bluestore_write_v2_random")) {
srand(time(NULL));
use_write_v2 = rand() % 2;
cct->_conf.set_val("bluestore_write_v2", std::to_string(use_write_v2));
}
_kv_only = false;
if (cct->_conf->bluestore_fsck_on_mount) {
int rc = fsck(cct->_conf->bluestore_fsck_on_mount_deep);
Expand Down

0 comments on commit 7de8a6c

Please sign in to comment.