]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: drop useless OSDService::update_osd_stat()
authorSage Weil <sage@redhat.com>
Tue, 3 Oct 2017 02:32:01 +0000 (21:32 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 3 Jul 2019 00:11:47 +0000 (20:11 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit a66f8bfe7d49f7d33ec027eeeb67870c610610db)

src/osd/OSD.cc
src/osd/OSD.h

index 49de7ba5030b3c543c6c2d307a88990a0b73b855..7e6e7137c767732ead8515cba0cbd7935b96b3d8 100644 (file)
@@ -809,23 +809,6 @@ osd_stat_t OSDService::set_osd_stat(const struct store_statfs_t &stbuf,
   }
 }
 
-void OSDService::update_osd_stat(vector<int>& hb_peers)
-{
-  // load osd stats first
-  struct store_statfs_t stbuf;
-  int r = osd->store->statfs(&stbuf);
-  if (r < 0) {
-    derr << "statfs() failed: " << cpp_strerror(r) << dendl;
-    return;
-  }
-
-  auto new_stat = set_osd_stat(stbuf, hb_peers, osd->num_pgs);
-  dout(20) << "update_osd_stat " << new_stat << dendl;
-  assert(new_stat.kb);
-  float ratio = ((float)new_stat.kb_used) / ((float)new_stat.kb);
-  check_full_status(ratio);
-}
-
 bool OSDService::check_osdmap_full(const set<pg_shard_t> &missing_on)
 {
   OSDMapRef osdmap = get_osdmap();
@@ -4713,13 +4696,24 @@ void OSD::heartbeat()
 
   dout(30) << "heartbeat checking stats" << dendl;
 
-  // refresh stats?
+  // refresh peer list and osd stats
   vector<int> hb_peers;
   for (map<int,HeartbeatInfo>::iterator p = heartbeat_peers.begin();
        p != heartbeat_peers.end();
        ++p)
     hb_peers.push_back(p->first);
-  service.update_osd_stat(hb_peers);
+
+  // refresh osd stats
+  struct store_statfs_t stbuf;
+  int r = store->statfs(&stbuf);
+  assert(r == 0);
+
+  auto new_stat = service.set_osd_stat(stbuf, hb_peers, get_num_pgs());
+  dout(20) << __func__ << new_stat << dendl;
+  assert(new_stat.kb);
+
+  float ratio = ((float)new_stat.kb_used) / ((float)new_stat.kb);
+  service.check_full_status(ratio);
 
   dout(5) << "heartbeat: " << service.get_osd_stat() << dendl;
 
index a24febee61f09a688d8ec3bb803d4b0626bb61bc..bd98f15cf16b9b5a0932654af24a27ac51c0e5d6 100644 (file)
@@ -884,7 +884,6 @@ public:
   osd_stat_t osd_stat;
   uint32_t seq = 0;
 
-  void update_osd_stat(vector<int>& hb_peers);
   osd_stat_t set_osd_stat(const struct store_statfs_t &stbuf,
                           vector<int>& hb_peers,
                          int num_pgs);
@@ -933,9 +932,9 @@ private:
   mutable int64_t injectfull = 0;
   s_names injectfull_state = NONE;
   float get_failsafe_full_ratio();
-  void check_full_status(float ratio);
   bool _check_full(DoutPrefixProvider *dpp, s_names type) const;
 public:
+  void check_full_status(float ratio);
   bool check_failsafe_full(DoutPrefixProvider *dpp) const;
   bool check_full(DoutPrefixProvider *dpp) const;
   bool check_backfill_full(DoutPrefixProvider *dpp) const;