From: Gabriel BenHanokh Date: Thu, 10 Mar 2022 15:40:31 +0000 (+0200) Subject: os/bluestore: Disable NCB functionality on rotational drives X-Git-Tag: v18.0.0~1201^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5fd09658edbf636dd462facfa9878656f641e7de;p=ceph.git os/bluestore: Disable NCB functionality on rotational drives NCB code needs to recover allocation map after an OSD crash. The recovery process on rotational drives is about 20x slower than SSD making this solution unacceptable for that environment  Signed-off-by: Gabriel Benhanokh --- 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;