]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: update check_full_status() to accept a pre-calculated ratio only
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 3 Jul 2017 03:02:24 +0000 (11:02 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 4 Jul 2017 10:22:08 +0000 (18:22 +0800)
We don't have to pass in the osd_stat, which is not necessary.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc
src/osd/OSD.h

index 3c33fafdec2bf8ee21b79ae063a261b09ba0db33..3f0249c7ab25353162df41e58857612df18c8127 100644 (file)
@@ -750,11 +750,10 @@ float OSDService::get_failsafe_full_ratio()
   return full_ratio;
 }
 
-void OSDService::check_full_status(const osd_stat_t &osd_stat)
+void OSDService::check_full_status(float ratio)
 {
   Mutex::Locker l(full_status_lock);
 
-  float ratio = ((float)osd_stat.kb_used) / ((float)osd_stat.kb);
   cur_ratio = ratio;
 
   // The OSDMap ratios take precendence.  So if the failsafe is .95 and
@@ -950,7 +949,8 @@ void OSDService::update_osd_stat(vector<int>& hb_peers)
 
   dout(20) << "update_osd_stat " << osd_stat << dendl;
 
-  check_full_status(osd_stat);
+  float ratio = ((float)osd_stat.kb_used) / ((float)osd_stat.kb);
+  check_full_status(ratio);
 }
 
 bool OSDService::check_osdmap_full(const set<pg_shard_t> &missing_on)
index 03b56735ec5a7565b854b00ed098d3d11b2f88ea..37835a6778f13f77e5c4853782a578931aa5d00b 100644 (file)
@@ -1089,7 +1089,7 @@ private:
   mutable int64_t injectfull = 0;
   s_names injectfull_state = NONE;
   float get_failsafe_full_ratio();
-  void check_full_status(const osd_stat_t &stat);
+  void check_full_status(float ratio);
   bool _check_full(s_names type, ostream &ss) const;
 public:
   bool check_failsafe_full(ostream &ss) const;