rotational/non-rotational OSD behavior for DB/WAL devices.
Prior to this commit this parameter determined what device class
settings to apply for BlueStore only. OSD had partially applied
actual journal/db/main device class for some operations, e.g. benchmark
on init or allocmap persistence, irrespective to this setting value.
This commit allows 'bluestore_debug_enforce_settings" to override the
actual device class completely.
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
type: str
level: dev
desc: Enforces specific hardware profile settings
- long_desc: '''hdd'' enforces settings intended for BlueStore on a rotational
- drive. ''ssd'' enforces settings intended for BlueStore on an SSD. ''default''
- indicates that BlueStore is to use settings based on the detected hardware.'
+ long_desc: '''hybrid'' enforces osd settings applicable to hybrid
+ (AKA main=hdd, db/wal=ssd) disk setup.
+ ''ssd'' enforces osd settings applicable to all-flash disk setup.
+ ''default'' specifies automatic settings selection based on real
+ detected hardware.'
default: default
enum_values:
- default
- - hdd
+ - hybrid
- ssd
with_legacy: true
- name: bluestore_allocator_lookup_policy
int unlink(std::string_view dirname, std::string_view filename);
int mkdir(std::string_view dirname);
int rmdir(std::string_view dirname);
+
bool wal_is_rotational();
bool db_is_rotational();
return 0;
}
-bool BlueStore::is_rotational()
+bool BlueStore::_is_main_rotational()
{
if (bdev) {
return bdev->is_rotational();
}
+ // Do open main devicet if not yet opened.
bool rotational = true;
int r = _open_path();
if (r < 0)
return rotational;
}
+bool BlueStore::is_rotational()
+{
+ return _use_rotational_settings();
+}
+
bool BlueStore::is_journal_rotational()
{
if (!bluefs) {
- dout(5) << __func__ << " bluefs disabled, default to store media type"
+ dout(5) << __func__ << " bluefs disabled, default to main device type"
<< dendl;
- return is_rotational();
+ return _use_rotational_settings();
+ }
+ if (cct->_conf->bluestore_debug_enforce_settings == "ssd" ||
+ cct->_conf->bluestore_debug_enforce_settings == "hybrid") {
+ dout(10) << __func__ << " overriden to ssd mode." << dendl;
+ return false;
}
- dout(10) << __func__ << " " << (int)bluefs->wal_is_rotational() << dendl;
- return bluefs->wal_is_rotational();
+ bool r = bluefs->wal_is_rotational();
+ dout(10) << __func__ << " " << (int)r << dendl;
+ return r;
}
bool BlueStore::is_db_rotational()
{
if (!bluefs) {
- dout(5) << __func__ << " bluefs disabled, default to store media type"
+ dout(5) << __func__ << " bluefs disabled, default to main device type"
<< dendl;
- return is_rotational();
+ return _use_rotational_settings();
}
- dout(10) << __func__ << " " << (int)bluefs->db_is_rotational() << dendl;
- return bluefs->db_is_rotational();
+ if (cct->_conf->bluestore_debug_enforce_settings == "ssd" ||
+ cct->_conf->bluestore_debug_enforce_settings == "hybrid") {
+ dout(10) << __func__ << " overriden to ssd mode." << dendl;
+ return false;
+ }
+ bool r = bluefs->db_is_rotational();
+ dout(10) << __func__ << " " << (int)r << dendl;
+ return r;
}
bool BlueStore::_use_rotational_settings()
{
- if (cct->_conf->bluestore_debug_enforce_settings == "hdd") {
- return true;
- }
if (cct->_conf->bluestore_debug_enforce_settings == "ssd") {
+ dout(10) << __func__ << " overriden to ssd." << dendl;
return false;
}
- return bdev->is_rotational();
+ if (cct->_conf->bluestore_debug_enforce_settings == "hybrid") {
+ dout(10) << __func__ << " overriden to hdd." << dendl;
+ return true;
+ }
+ bool r = _is_main_rotational();
+ dout(0) << __func__ << " returns " << r << dendl;
+ return r;
}
bool BlueStore::is_statfs_recoverable() const
std::array<std::tuple<uint64_t, uint64_t, uint64_t>, 5> alloc_stats_history =
{ std::make_tuple(0ul, 0ul, 0ul) };
+ bool _is_main_rotational();
inline bool _use_rotational_settings();
public:
SetVal(g_conf(), "bluestore_write_v2", "false");
SetVal(g_conf(), "bluestore_max_blob_size", "524288");
- SetVal(g_conf(), "bluestore_debug_enforce_settings", "hdd");
+ SetVal(g_conf(), "bluestore_debug_enforce_settings", "hybrid");
g_conf().apply_changes(nullptr);
StartDeferred(65536);
size_t alloc_size = 65536;
size_t write_size = 4096;
SetVal(g_conf(), "bluestore_write_v2", "false");
- SetVal(g_conf(), "bluestore_debug_enforce_settings", "hdd");
+ SetVal(g_conf(), "bluestore_debug_enforce_settings", "hybrid");
SetVal(g_conf(), "bluestore_block_db_create", "true");
SetVal(g_conf(), "bluestore_block_db_size", stringify(1 << 30).c_str());
return;
SetVal(g_conf(), "bluestore_write_v2", "false");
- SetVal(g_conf(), "bluestore_debug_enforce_settings", "hdd");
+ SetVal(g_conf(), "bluestore_debug_enforce_settings", "hybrid");
StartDeferred(0x1000);
int r;
SetVal(g_conf(), "bluestore_default_buffered_write", "true");
SetVal(g_conf(), "bluestore_max_blob_size", "65536");
- SetVal(g_conf(), "bluestore_debug_enforce_settings", "hdd");
+ SetVal(g_conf(), "bluestore_debug_enforce_settings", "hybrid");
SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
g_conf().apply_changes(nullptr);