#undef dout_prefix
#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch())
+const double OSD::OSD_TICK_INTERVAL = 1.0;
+
static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) {
return *_dout << "osd." << whoami << " " << epoch << " ";
}
Dispatcher(cct_),
osd_lock("OSD::osd_lock"),
tick_timer(cct, osd_lock),
+ tick_timer_lock("OSD::tick_timer_lock"),
+ tick_timer_without_osd_lock(cct, tick_timer_lock),
authorize_handler_cluster_registry(new AuthAuthorizeHandlerRegistry(cct,
cct->_conf->auth_supported.length() ?
cct->_conf->auth_supported :
return 0;
tick_timer.init();
+ tick_timer_without_osd_lock.init();
service.backfill_request_timer.init();
// mount.
// tick
tick_timer.add_event_after(cct->_conf->osd_heartbeat_interval, new C_Tick(this));
+ {
+ Mutex::Locker l(tick_timer_lock);
+ tick_timer_without_osd_lock.add_event_after(cct->_conf->osd_heartbeat_interval, new C_Tick_WithoutOSDLock(this));
+ }
service.init();
service.publish_map(osdmap);
tick_timer.shutdown();
+ {
+ Mutex::Locker l(tick_timer_lock);
+ tick_timer_without_osd_lock.shutdown();
+ }
+
// note unmount epoch
dout(10) << "noting clean unmount in epoch " << osdmap->get_epoch() << dendl;
superblock.mounted = service.get_boot_epoch();
// periodically kick recovery work queue
recovery_tp.wake();
- if (!scrub_random_backoff()) {
- sched_scrub();
- }
-
check_replay_queue();
}
check_ops_in_flight();
- tick_timer.add_event_after(1.0, new C_Tick(this));
+ tick_timer.add_event_after(OSD_TICK_INTERVAL, new C_Tick(this));
+}
+
+void OSD::tick_without_osd_lock()
+{
+ assert(tick_timer_lock.is_locked());
+ dout(5) << "tick_without_osd_lock" << dendl;
+
+ if (!scrub_random_backoff()) {
+ sched_scrub();
+ }
+ tick_timer_without_osd_lock.add_event_after(OSD_TICK_INTERVAL, new C_Tick_WithoutOSDLock(this));
}
void OSD::check_ops_in_flight()
void OSD::sched_scrub()
{
- assert(osd_lock.is_locked());
-
bool load_is_low = scrub_should_schedule();
dout(20) << "sched_scrub load_is_low=" << (int)load_is_low << dendl;
Mutex osd_lock; // global lock
SafeTimer tick_timer; // safe timer (osd_lock)
+ // Tick timer for those stuff that do not need osd_lock
+ Mutex tick_timer_lock;
+ SafeTimer tick_timer_without_osd_lock;
+
+ static const double OSD_TICK_INTERVAL; // tick interval for tick_timer and tick_timer_without_osd_lock
+
AuthAuthorizeHandlerRegistry *authorize_handler_cluster_registry;
AuthAuthorizeHandlerRegistry *authorize_handler_service_registry;
}
};
+ class C_Tick_WithoutOSDLock : public Context {
+ OSD *osd;
+ public:
+ C_Tick_WithoutOSDLock(OSD *o) : osd(o) {}
+ void finish(int r) {
+ osd->tick_without_osd_lock();
+ }
+ };
+
Cond dispatch_cond;
int dispatch_running;
void create_logger();
void create_recoverystate_perf();
void tick();
+ void tick_without_osd_lock();
void _dispatch(Message *m);
void dispatch_op(OpRequestRef op);
bool dispatch_op_fast(OpRequestRef& op, OSDMapRef& osdmap);