From 5fd09658edbf636dd462facfa9878656f641e7de Mon Sep 17 00:00:00 2001 From: Gabriel BenHanokh Date: Thu, 10 Mar 2022 17:40:31 +0200 Subject: [PATCH] =?utf8?q?os/bluestore:=20Disable=20NCB=20functionality=20?= =?utf8?q?on=20rotational=20drives=20NCB=20code=20needs=20to=20recover=20a?= =?utf8?q?llocation=20map=20after=20an=20OSD=20crash.=20The=20recovery=20p?= =?utf8?q?rocess=20on=20rotational=20drives=20is=20about=2020x=20slower=20?= =?utf8?q?than=20SSD=20making=20this=20solution=20unacceptable=20for=20tha?= =?utf8?q?t=20environment=C2=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Benhanokh --- src/os/bluestore/BlueFS.cc | 8 ++++++++ src/os/bluestore/BlueFS.h | 1 + src/os/bluestore/BlueStore.cc | 13 ++++++++++++- src/os/bluestore/BlueStore.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index baae7c5ab2b6..70fa142b7177 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -4083,6 +4083,14 @@ bool BlueFS::wal_is_rotational() return bdev[BDEV_SLOW]->is_rotational(); } +bool BlueFS::db_is_rotational() +{ + if (bdev[BDEV_DB]) { + return bdev[BDEV_DB]->is_rotational(); + } + return bdev[BDEV_SLOW]->is_rotational(); +} + /* Algorithm. do_replay_recovery_read is used when bluefs log abruptly ends, but it seems that more data should be there. diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 4307507d13b9..3f0905a59916 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -586,6 +586,7 @@ public: int mkdir(std::string_view dirname); int rmdir(std::string_view dirname); bool wal_is_rotational(); + bool db_is_rotational(); bool dir_exists(std::string_view dirname); int stat(std::string_view dirname, std::string_view filename, diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 86062f290f03..92c990760810 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6057,6 +6057,17 @@ bool BlueStore::is_journal_rotational() return bluefs->wal_is_rotational(); } +bool BlueStore::is_db_rotational() +{ + if (!bluefs) { + dout(5) << __func__ << " bluefs disabled, default to store media type" + << dendl; + return is_rotational(); + } + dout(10) << __func__ << " " << (int)bluefs->db_is_rotational() << dendl; + return bluefs->db_is_rotational(); +} + bool BlueStore::_use_rotational_settings() { if (cct->_conf->bluestore_debug_enforce_settings == "hdd") { @@ -6384,7 +6395,7 @@ int BlueStore::_open_db_and_around(bool read_only, bool to_repair) } // when function is called in repair mode (to_repair=true) we skip db->open()/create() - if (!read_only && !to_repair && cct->_conf->bluestore_allocation_from_file + if (!is_db_rotational() && !read_only && !to_repair && cct->_conf->bluestore_allocation_from_file #ifdef HAVE_LIBZBD && !bdev->is_smr() #endif diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 0f804595ebb3..10fdd0f721a0 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2794,6 +2794,7 @@ public: bool is_rotational() override; bool is_journal_rotational() override; + bool is_db_rotational() ; std::string get_default_device_class() override { std::string device_class; -- 2.47.3