]> 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)
committerSage Weil <sage@redhat.com>
Wed, 15 Aug 2018 22:18:43 +0000 (17:18 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index e83e29b8bb6a2594eafe49fc82e1ddcf3a970881..47f62e02ea17bdb9dde6c9e778ff8d93f4016559 100644 (file)
@@ -810,23 +810,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();
@@ -4706,13 +4689,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 195c8dac634bd27b5dd8836127906bc90e0e3d45..ea58807a632bad4643553466a77422a45c85165e 100644 (file)
@@ -881,7 +881,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);
@@ -930,9 +929,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;