utime_t now = ceph_clock_now(NULL);
double dur = now - last_recalibrate;
last_recalibrate = now;
- unsigned prob = promote_probability_millis;
+ unsigned prob = promote_probability_millis.read();
uint64_t target_obj_sec = g_conf->osd_tier_promote_max_objects_sec;
uint64_t target_bytes_sec = g_conf->osd_tier_promote_max_bytes_sec;
dout(10) << __func__ << " actual " << actual
<< ", actual/prob ratio " << ratio
<< ", adjusted new_prob " << new_prob
- << ", prob " << promote_probability_millis << " -> " << prob
+ << ", prob " << promote_probability_millis.read() << " -> " << prob
<< dendl;
- promote_probability_millis = prob;
+ promote_probability_millis.set(prob);
// set hard limits for this interval to mitigate stampedes
promote_max_objects = target_obj_sec * OSD::OSD_TICK_INTERVAL * 2;
}
/// throttle promotion attempts
- unsigned promote_probability_millis; ///< probability thousands. one word.
+ atomic_t promote_probability_millis; ///< probability thousands. one word.
PromoteCounter promote_counter;
utime_t last_recalibrate;
unsigned long promote_max_objects, promote_max_bytes;
bool promote_throttle() {
// NOTE: lockless! we rely on the probability being a single word.
promote_counter.attempt();
- if ((unsigned)rand() % 1000 > promote_probability_millis)
+ if ((unsigned)rand() % 1000 > promote_probability_millis.read())
return true; // yes throttle (no promote)
if (promote_max_objects &&
promote_counter.objects.read() > promote_max_objects)