|
22 | 22 | #undef dout_prefix |
23 | 23 | #define dout_prefix *_dout << "cephfs::mirror::Mirror " << __func__ |
24 | 24 |
|
| 25 | +using namespace std::chrono; |
| 26 | + |
25 | 27 | // Performance Counters |
26 | 28 | enum { |
27 | 29 | l_cephfs_mirror_first = 4000, |
@@ -247,7 +249,7 @@ int Mirror::init_mon_client() { |
247 | 249 | return r; |
248 | 250 | } |
249 | 251 |
|
250 | | - r = m_monc->authenticate(std::chrono::duration<double>(m_cct->_conf.get_val<std::chrono::seconds>("client_mount_timeout")).count()); |
| 252 | + r = m_monc->authenticate(duration<double>(m_cct->_conf.get_val<seconds>("client_mount_timeout")).count()); |
251 | 253 | if (r < 0) { |
252 | 254 | derr << ": failed to authenticate to monitor: " << cpp_strerror(r) << dendl; |
253 | 255 | return r; |
@@ -547,19 +549,18 @@ void Mirror::peer_removed(const Filesystem &filesystem, const Peer &peer) { |
547 | 549 | void Mirror::update_fs_mirrors() { |
548 | 550 | dout(20) << dendl; |
549 | 551 |
|
550 | | - auto now = ceph_clock_now(); |
551 | | - double blocklist_interval = g_ceph_context->_conf.get_val<std::chrono::seconds> |
552 | | - ("cephfs_mirror_restart_mirror_on_blocklist_interval").count(); |
553 | | - double failed_interval = g_ceph_context->_conf.get_val<std::chrono::seconds> |
554 | | - ("cephfs_mirror_restart_mirror_on_failure_interval").count(); |
| 552 | + seconds blocklist_interval = g_ceph_context->_conf.get_val<seconds> |
| 553 | + ("cephfs_mirror_restart_mirror_on_blocklist_interval"); |
| 554 | + seconds failed_interval = g_ceph_context->_conf.get_val<seconds> |
| 555 | + ("cephfs_mirror_restart_mirror_on_failure_interval"); |
555 | 556 |
|
556 | 557 | { |
557 | 558 | std::scoped_lock locker(m_lock); |
558 | 559 | for (auto &[filesystem, mirror_action] : m_mirror_actions) { |
559 | 560 | auto failed_restart = mirror_action.fs_mirror && mirror_action.fs_mirror->is_failed() && |
560 | | - (failed_interval > 0 && (mirror_action.fs_mirror->get_failed_ts() - now) > failed_interval); |
| 561 | + (failed_interval.count() > 0 && duration_cast<seconds>(mirror_action.fs_mirror->get_failed_ts() - clock::now()) > failed_interval); |
561 | 562 | auto blocklisted_restart = mirror_action.fs_mirror && mirror_action.fs_mirror->is_blocklisted() && |
562 | | - (blocklist_interval > 0 && (mirror_action.fs_mirror->get_blocklisted_ts() - now) > blocklist_interval); |
| 563 | + (blocklist_interval.count() > 0 && duration_cast<seconds>(mirror_action.fs_mirror->get_blocklisted_ts() - clock::now()) > blocklist_interval); |
563 | 564 |
|
564 | 565 | if (!mirror_action.action_in_progress && !_is_restarting(filesystem)) { |
565 | 566 | if (failed_restart || blocklisted_restart) { |
@@ -592,7 +593,7 @@ void Mirror::schedule_mirror_update_task() { |
592 | 593 | m_timer_task = nullptr; |
593 | 594 | update_fs_mirrors(); |
594 | 595 | }); |
595 | | - double after = g_ceph_context->_conf.get_val<std::chrono::seconds> |
| 596 | + double after = g_ceph_context->_conf.get_val<seconds> |
596 | 597 | ("cephfs_mirror_action_update_interval").count(); |
597 | 598 | dout(20) << ": scheduling fs mirror update (" << m_timer_task << ") after " |
598 | 599 | << after << " seconds" << dendl; |
|
0 commit comments