osd: move buffer-related stats from tick() to tick_without_osd_lock()

1. these counters are of type atomic_t and are public-access safe.

2. since the tick() thread requires the big osd_lock and thus may
   not tick at a constant interval, it is good for accuracy and
   performance to move the buffer-related stats to the
   tick_without_osd_lock() thread instead.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2016-08-01 10:08:51 +08:00
parent 013f394d83
commit 1addc92fc4

View File

@ -4300,12 +4300,6 @@ void OSD::tick()
assert(osd_lock.is_locked());
dout(10) << "tick" << dendl;
logger->set(l_osd_buf, buffer::get_total_alloc());
logger->set(l_osd_history_alloc_bytes, SHIFT_ROUND_UP(buffer::get_history_alloc_bytes(), 20));
logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
logger->set(l_osd_cached_crc, buffer::get_cached_crc());
logger->set(l_osd_cached_crc_adjusted, buffer::get_cached_crc_adjusted());
if (is_active() || is_waiting_for_healthy()) {
maybe_update_heartbeat_peers();
@ -4342,6 +4336,12 @@ void OSD::tick_without_osd_lock()
assert(tick_timer_lock.is_locked());
dout(10) << "tick_without_osd_lock" << dendl;
logger->set(l_osd_buf, buffer::get_total_alloc());
logger->set(l_osd_history_alloc_bytes, SHIFT_ROUND_UP(buffer::get_history_alloc_bytes(), 20));
logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
logger->set(l_osd_cached_crc, buffer::get_cached_crc());
logger->set(l_osd_cached_crc_adjusted, buffer::get_cached_crc_adjusted());
// osd_lock is not being held, which means the OSD state
// might change when doing the monitor report
if (is_active() || is_waiting_for_healthy()) {