osd: drop useless OSDService::update_osd_stat()

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-10-02 21:32:01 -05:00
parent fa120cec38
commit a66f8bfe7d
2 changed files with 14 additions and 21 deletions

View 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;

View 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;