]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add method to check for laggy osds
authordparmar18 <dparmar@redhat.com>
Thu, 16 Feb 2023 09:48:42 +0000 (15:18 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Fri, 20 Oct 2023 10:30:29 +0000 (16:00 +0530)
Fixes: https://tracker.ceph.com/issues/58023
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit 95fbe303a9692ac8dd2694298e32af951adfbe06)

src/osd/OSDMap.cc
src/osd/OSDMap.h

index 78316779b524f562e792e272c4fc334581404c11..30527dbeeee0154a44608e4b0d400f1e93fdc1da 100644 (file)
@@ -1836,6 +1836,18 @@ uint64_t OSDMap::get_up_osd_features() const
   return cached_up_osd_features;
 }
 
+bool OSDMap::any_osd_laggy() const
+{
+  for (int osd = 0; osd < max_osd; ++osd) {
+    if (!is_up(osd)) { continue; }
+    const auto &xi = get_xinfo(osd);
+    if (xi.laggy_probability || xi.laggy_interval) {
+      return true;
+    }
+  }
+  return false;
+}
+
 void OSDMap::dedup(const OSDMap *o, OSDMap *n)
 {
   using ceph::encode;
index 28449c8b63cd8a35c31bf852782964578f9fcc2b..79eaf574269918a51882e79406015ef5049119a1 100644 (file)
@@ -643,6 +643,7 @@ private:
  public:
   bool have_crc() const { return crc_defined; }
   uint32_t get_crc() const { return crc; }
+  bool any_osd_laggy() const;
 
   std::shared_ptr<CrushWrapper> crush;       // hierarchical map
   bool stretch_mode_enabled; // we are in stretch mode, requiring multiple sites