void lc_watchdog_delete(struct lc_watchdog *lcw) { int dead; ENTRY; LASSERT(lcw != NULL); cfs_timer_disarm(&lcw->lcw_timer); lcw_update_time(lcw, "stopped"); cfs_spin_lock_bh(&lcw->lcw_lock); cfs_spin_lock_bh(&lcw_pending_timers_lock); if (unlikely(!cfs_list_empty(&lcw->lcw_list))) { cfs_list_del_init(&lcw->lcw_list); lcw->lcw_refcount--; /* -1 ref for pending list */ } lcw->lcw_refcount--; /* -1 ref for owner */ dead = lcw->lcw_refcount == 0; cfs_spin_unlock_bh(&lcw_pending_timers_lock); cfs_spin_unlock_bh(&lcw->lcw_lock); if (dead) LIBCFS_FREE(lcw, sizeof(*lcw)); cfs_down(&lcw_refcount_sem); if (--lcw_refcount == 0) lcw_dispatch_stop(); cfs_up(&lcw_refcount_sem); EXIT; }
/* * XXX: there might be a case where removed object(s) do not add free * space (empty object). if the number of such deletions is high, then * we can start to update statfs too often - a rpc storm * TODO: some throttling is needed */ void osp_statfs_need_now(struct osp_device *d) { if (!d->opd_statfs_update_in_progress) { /* * if current status is -ENOSPC (lack of free space on OST) * then we should poll OST immediately once object destroy * is replied */ d->opd_statfs_fresh_till = cfs_time_shift(-1); cfs_timer_disarm(&d->opd_statfs_timer); wake_up(&d->opd_pre_waitq); } }
void osp_precreate_fini(struct osp_device *d) { struct ptlrpc_thread *thread = &d->opd_pre_thread; ENTRY; cfs_timer_disarm(&d->opd_statfs_timer); thread->t_flags = SVC_STOPPING; wake_up(&d->opd_pre_waitq); wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED); EXIT; }
static int osp_statfs_update(struct osp_device *d) { struct ptlrpc_request *req; struct obd_import *imp; union ptlrpc_async_args *aa; int rc; ENTRY; CDEBUG(D_CACHE, "going to update statfs\n"); imp = d->opd_obd->u.cli.cl_import; LASSERT(imp); req = ptlrpc_request_alloc(imp, &RQF_OST_STATFS); if (req == NULL) RETURN(-ENOMEM); rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_STATFS); if (rc) { ptlrpc_request_free(req); RETURN(rc); } ptlrpc_request_set_replen(req); req->rq_request_portal = OST_CREATE_PORTAL; ptlrpc_at_set_req_timeout(req); req->rq_interpret_reply = (ptlrpc_interpterer_t)osp_statfs_interpret; aa = ptlrpc_req_async_args(req); aa->pointer_arg[0] = d; /* * no updates till reply */ cfs_timer_disarm(&d->opd_statfs_timer); d->opd_statfs_fresh_till = cfs_time_shift(obd_timeout * 1000); d->opd_statfs_update_in_progress = 1; ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1); RETURN(0); }
void osp_precreate_fini(struct osp_device *d) { struct ptlrpc_thread *thread; ENTRY; cfs_timer_disarm(&d->opd_statfs_timer); if (d->opd_pre == NULL) RETURN_EXIT; thread = &d->opd_pre_thread; thread->t_flags = SVC_STOPPING; wake_up(&d->opd_pre_waitq); wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED); OBD_FREE_PTR(d->opd_pre); d->opd_pre = NULL; EXIT; }
void stop_shrinker_timer() { /* cancel the timer */ cfs_timer_disarm(&shrinker_timer); cfs_timer_done(&shrinker_timer); }