struct list_head exp_obd_chain;
struct hlist_node exp_uuid_hash; /** uuid-export hash*/
struct hlist_node exp_nid_hash; /** nid-export hash */
- /**
- * All exports eligible for ping evictor are linked into a list
- * through this field in "most time since last request on this export"
- * order
- * protected by obd_dev_lock
- */
- struct list_head exp_obd_chain_timed;
/** Obd device of this export */
struct obd_device *exp_obd;
/**
spinlock_t exp_uncommitted_replies_lock;
/** Last committed transno for this export */
__u64 exp_last_committed;
- /** When was last request received */
- unsigned long exp_last_request_time;
/** On replay all requests waiting for replay are linked here */
struct list_head exp_req_replay_queue;
/**
return exp_max_brw_size(exp) > ONE_MB_BRW_SIZE;
}
-static inline int exp_expired(struct obd_export *exp, long age)
-{
- LASSERT(exp->exp_delayed);
- return time_before(cfs_time_add(exp->exp_last_request_time, age),
- get_seconds());
-}
-
static inline int exp_connect_cancelset(struct obd_export *exp)
{
LASSERT(exp != NULL);
struct rw_semaphore obd_observer_link_sem;
struct obd_notify_upcall obd_upcall;
struct obd_export *obd_self_export;
- /* list of exports in LRU order, for ping evictor, with obd_dev_lock */
- struct list_head obd_exports_timed;
int obd_max_recoverable_clients;
atomic_t obd_connected_clients;
INIT_LIST_HEAD(&export->exp_handle.h_link);
INIT_LIST_HEAD(&export->exp_hp_rpcs);
class_handle_hash(&export->exp_handle, &export_handle_ops);
- export->exp_last_request_time = get_seconds();
spin_lock_init(&export->exp_lock);
spin_lock_init(&export->exp_rpc_lock);
INIT_HLIST_NODE(&export->exp_uuid_hash);
class_incref(obd, "export", export);
list_add(&export->exp_obd_chain, &export->exp_obd->obd_exports);
- list_add_tail(&export->exp_obd_chain_timed,
- &export->exp_obd->obd_exports_timed);
export->exp_obd->obd_num_exports++;
spin_unlock(&obd->obd_dev_lock);
cfs_hash_putref(hash);
&exp->exp_uuid_hash);
list_move(&exp->exp_obd_chain, &exp->exp_obd->obd_unlinked_exports);
- list_del_init(&exp->exp_obd_chain_timed);
exp->exp_obd->obd_num_exports--;
spin_unlock(&exp->exp_obd->obd_dev_lock);
class_export_put(exp);
INIT_LIST_HEAD(&obd->obd_exports);
INIT_LIST_HEAD(&obd->obd_unlinked_exports);
INIT_LIST_HEAD(&obd->obd_delayed_exports);
- INIT_LIST_HEAD(&obd->obd_exports_timed);
spin_lock_init(&obd->obd_nid_lock);
spin_lock_init(&obd->obd_dev_lock);
mutex_init(&obd->obd_dev_mutex);
}
obd->obd_self_export = exp;
- list_del_init(&exp->exp_obd_chain_timed);
class_export_put(exp);
err = obd_setup(obd, lcfg);
ocd->ocd_group = FID_SEQ_ECHO;
rc = obd_connect(env, &ec->ec_exp, tgt, &echo_uuid, ocd, NULL);
- if (rc == 0) {
- /* Turn off pinger because it connects to tgt obd directly. */
- spin_lock(&tgt->obd_dev_lock);
- list_del_init(&ec->ec_exp->exp_obd_chain_timed);
- spin_unlock(&tgt->obd_dev_lock);
- }
kfree(ocd);
ptlrpc_server_finish_request(svcpt, req);
}
-/**
- * This function makes sure dead exports are evicted in a timely manner.
- * This function is only called when some export receives a message (i.e.,
- * the network is up.)
- */
-static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)
-{
- struct obd_export *oldest_exp;
- time_t oldest_time, new_time;
-
- LASSERT(exp);
-
- /* Compensate for slow machines, etc, by faking our request time
- into the future. Although this can break the strict time-ordering
- of the list, we can be really lazy here - we don't have to evict
- at the exact right moment. Eventually, all silent exports
- will make it to the top of the list. */
-
- /* Do not pay attention on 1sec or smaller renewals. */
- new_time = get_seconds() + extra_delay;
- if (exp->exp_last_request_time + 1 /*second */ >= new_time)
- return;
-
- exp->exp_last_request_time = new_time;
-
- /* exports may get disconnected from the chain even though the
- export has references, so we must keep the spin lock while
- manipulating the lists */
- spin_lock(&exp->exp_obd->obd_dev_lock);
-
- if (list_empty(&exp->exp_obd_chain_timed)) {
- /* this one is not timed */
- spin_unlock(&exp->exp_obd->obd_dev_lock);
- return;
- }
-
- list_move_tail(&exp->exp_obd_chain_timed,
- &exp->exp_obd->obd_exports_timed);
-
- oldest_exp = list_entry(exp->exp_obd->obd_exports_timed.next,
- struct obd_export, exp_obd_chain_timed);
- oldest_time = oldest_exp->exp_last_request_time;
- spin_unlock(&exp->exp_obd->obd_dev_lock);
-}
-
/**
* Sanity check request \a req.
* Return 0 if all is ok, error code otherwise.
if (rc)
goto err_req;
- ptlrpc_update_export_timer(req->rq_export, 0);
}
/* req_in handling should/must be fast */
if (likely(request->rq_export)) {
if (unlikely(ptlrpc_check_req(request)))
goto put_conn;
- ptlrpc_update_export_timer(request->rq_export,
- timediff_usecs >> 19);
}
/* Discard requests queued for longer than the deadline.