diff options
author | Samuel Just <sam.just@inktank.com> | 2013-03-21 11:37:24 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-03-21 18:51:39 -0700 |
commit | cec3d82ec427811044fde0ea017e3e48a1b99dcb (patch) | |
tree | d3c358b55c218eb245b0d1fc25a17c18d150a57f | |
parent | f00f3bc4e5db04be036ec737e4ed9d9281f64eb3 (diff) | |
download | ceph-cec3d82ec427811044fde0ea017e3e48a1b99dcb.tar.gz |
OSDService: add too_full_for_backfill
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/osd/OSD.cc | 15 | ||||
-rw-r--r-- | src/osd/OSD.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 978c24056f5..c32f36df728 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -186,6 +186,7 @@ OSDService::OSDService(OSD *osd) : full_status_lock("OSDService::full_status_lock"), cur_state(NONE), last_msg(0), + cur_ratio(0), is_stopping_lock("OSDService::is_stopping_lock"), state(NOT_STOPPING) {} @@ -1997,6 +1998,7 @@ void OSDService::check_nearfull_warning(const osd_stat_t &osd_stat) float ratio = ((float)osd_stat.kb_used) / ((float)osd_stat.kb); float nearfull_ratio = get_nearfull_ratio(); float full_ratio = get_full_ratio(); + cur_ratio = ratio; if (full_ratio > 0 && ratio > full_ratio) { new_state = FULL; @@ -2027,6 +2029,19 @@ bool OSDService::check_failsafe_full() return false; } +bool OSDService::too_full_for_backfill(double *_ratio, double *_max_ratio) +{ + Mutex::Locker l(full_status_lock); + double max_ratio; + max_ratio = g_conf->osd_backfill_full_ratio; + if (_ratio) + *_ratio = cur_ratio; + if (_max_ratio) + *_max_ratio = max_ratio; + return cur_ratio >= max_ratio; +} + + void OSD::update_osd_stat() { // fill in osd stats too diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 148b761f532..5166ae74aa4 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -401,10 +401,13 @@ public: Mutex full_status_lock; enum s_names { NONE, NEAR, FULL } cur_state; time_t last_msg; + double cur_ratio; float get_full_ratio(); float get_nearfull_ratio(); void check_nearfull_warning(const osd_stat_t &stat); bool check_failsafe_full(); + bool too_full_for_backfill(double *ratio, double *max_ratio); + // -- stopping -- Mutex is_stopping_lock; |