static void nrs_tbf_rule_fini(struct nrs_tbf_rule *rule)
{
- LASSERT(cfs_atomic_read(&rule->tr_ref) == 0);
+ LASSERT(atomic_read(&rule->tr_ref) == 0);
LASSERT(cfs_list_empty(&rule->tr_cli_list));
LASSERT(cfs_list_empty(&rule->tr_linkage));
*/
static void nrs_tbf_rule_put(struct nrs_tbf_rule *rule)
{
- if (cfs_atomic_dec_and_test(&rule->tr_ref))
+ if (atomic_dec_and_test(&rule->tr_ref))
nrs_tbf_rule_fini(rule);
}
*/
static inline void nrs_tbf_rule_get(struct nrs_tbf_rule *rule)
{
- cfs_atomic_inc(&rule->tr_ref);
+ atomic_inc(&rule->tr_ref);
}
static void
cli->tc_depth = rule->tr_depth;
cli->tc_ntoken = rule->tr_depth;
cli->tc_check_time = ktime_to_ns(ktime_get());
- cli->tc_rule_sequence = cfs_atomic_read(&head->th_rule_sequence);
+ cli->tc_rule_sequence = atomic_read(&head->th_rule_sequence);
cli->tc_rule_generation = rule->tr_generation;
if (cli->tc_in_heap)
head->th_ops->o_cli_init(cli, req);
CFS_INIT_LIST_HEAD(&cli->tc_list);
CFS_INIT_LIST_HEAD(&cli->tc_linkage);
- cfs_atomic_set(&cli->tc_ref, 1);
+ atomic_set(&cli->tc_ref, 1);
rule = nrs_tbf_rule_match(head, cli);
nrs_tbf_cli_reset(head, rule, cli);
}
{
LASSERT(cfs_list_empty(&cli->tc_list));
LASSERT(!cli->tc_in_heap);
- LASSERT(cfs_atomic_read(&cli->tc_ref) == 0);
+ LASSERT(atomic_read(&cli->tc_ref) == 0);
nrs_tbf_cli_rule_put(cli);
OBD_FREE_PTR(cli);
}
rule->tr_rpc_rate = start->tc_rpc_rate;
rule->tr_nsecs = NSEC_PER_SEC / rule->tr_rpc_rate;
rule->tr_depth = tbf_depth;
- cfs_atomic_set(&rule->tr_ref, 1);
+ atomic_set(&rule->tr_ref, 1);
CFS_INIT_LIST_HEAD(&rule->tr_cli_list);
CFS_INIT_LIST_HEAD(&rule->tr_nids);
cfs_list_add(&rule->tr_linkage, &head->th_list);
rule->tr_head = head;
spin_unlock(&head->th_rule_lock);
- cfs_atomic_inc(&head->th_rule_sequence);
+ atomic_inc(&head->th_rule_sequence);
if (start->tc_rule_flags & NTRS_DEFAULT) {
rule->tr_flags |= NTRS_DEFAULT;
LASSERT(head->th_rule == NULL);
{
struct nrs_tbf_rule *rule;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_lock);
rule = nrs_tbf_rule_find(head, change->tc_name);
if (rule == NULL)
{
struct nrs_tbf_rule *rule;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_lock);
if (strcmp(stop->tc_name, NRS_TBF_DEFAULT_RULE) == 0)
return -EPERM;
{
int rc;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_lock);
switch (cmd->tc_cmd) {
case NRS_CTL_TBF_START_RULE:
struct nrs_tbf_client,
tc_hnode);
- cfs_atomic_inc(&cli->tc_ref);
+ atomic_inc(&cli->tc_ref);
}
static void nrs_tbf_jobid_hop_put(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
struct nrs_tbf_client,
tc_hnode);
- cfs_atomic_dec(&cli->tc_ref);
+ atomic_dec(&cli->tc_ref);
}
static void nrs_tbf_jobid_hop_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
struct nrs_tbf_client,
tc_hnode);
- LASSERT(cfs_atomic_read(&cli->tc_ref) == 0);
+ LASSERT(atomic_read(&cli->tc_ref) == 0);
nrs_tbf_cli_fini(cli);
}
cli = cfs_list_entry(bkt->ntb_lru.next,
struct nrs_tbf_client,
tc_lru);
- LASSERT(cfs_atomic_read(&cli->tc_ref) == 0);
+ LASSERT(atomic_read(&cli->tc_ref) == 0);
cfs_hash_bd_del_locked(hs, &bd, &cli->tc_hnode);
cfs_list_move(&cli->tc_lru, &zombies);
}
rule->tr_name,
rule->tr_jobids_str,
rule->tr_rpc_rate,
- cfs_atomic_read(&rule->tr_ref) - 1);
+ atomic_read(&rule->tr_ref) - 1);
}
static int
struct nrs_tbf_client,
tc_hnode);
- cfs_atomic_inc(&cli->tc_ref);
+ atomic_inc(&cli->tc_ref);
}
static void nrs_tbf_nid_hop_put(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
struct nrs_tbf_client,
tc_hnode);
- cfs_atomic_dec(&cli->tc_ref);
+ atomic_dec(&cli->tc_ref);
}
static void nrs_tbf_nid_hop_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
struct nrs_tbf_client,
tc_hnode);
- LASSERTF(cfs_atomic_read(&cli->tc_ref) == 0,
+ LASSERTF(atomic_read(&cli->tc_ref) == 0,
"Busy TBF object from client with NID %s, with %d refs\n",
- libcfs_nid2str(cli->tc_nid), cfs_atomic_read(&cli->tc_ref));
+ libcfs_nid2str(cli->tc_nid), atomic_read(&cli->tc_ref));
nrs_tbf_cli_fini(cli);
}
rule->tr_name,
rule->tr_nids_str,
rule->tr_rpc_rate,
- cfs_atomic_read(&rule->tr_ref) - 1);
+ atomic_read(&rule->tr_ref) - 1);
}
static int
if (head->th_binheap == NULL)
GOTO(out_free_head, rc = -ENOMEM);
- cfs_atomic_set(&head->th_rule_sequence, 0);
+ atomic_set(&head->th_rule_sequence, 0);
spin_lock_init(&head->th_rule_lock);
CFS_INIT_LIST_HEAD(&head->th_list);
hrtimer_init(&head->th_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
* \param[in] opc the opcode
* \param[in,out] arg used for passing parameters and information
*
- * \pre spin_is_locked(&policy->pol_nrs->->nrs_lock)
- * \post spin_is_locked(&policy->pol_nrs->->nrs_lock)
+ * \pre assert_spin_locked(&policy->pol_nrs->->nrs_lock)
+ * \post assert_spin_locked(&policy->pol_nrs->->nrs_lock)
*
* \retval 0 operation carried out successfully
* \retval -ve error
int rc = 0;
ENTRY;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_lock);
- switch (opc) {
+ switch ((enum nrs_ctl_tbf)opc) {
default:
RETURN(-EINVAL);
spin_lock(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
LASSERT(cli->tc_rule);
if (cli->tc_rule_sequence !=
- cfs_atomic_read(&head->th_rule_sequence) ||
+ atomic_read(&head->th_rule_sequence) ||
cli->tc_rule->tr_flags & NTRS_STOPPING) {
struct nrs_tbf_rule *rule;
nrs_tbf_cli_init(head, cli, req);
tmp = head->th_ops->o_cli_findadd(head, cli);
if (tmp != cli) {
- cfs_atomic_dec(&cli->tc_ref);
+ atomic_dec(&cli->tc_ref);
nrs_tbf_cli_fini(cli);
cli = tmp;
}
struct nrs_tbf_client *cli;
cfs_binheap_node_t *node;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
if (!peek && policy->pol_nrs->nrs_throttling)
return NULL;
struct nrs_tbf_client *cli;
int rc = 0;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
cli = container_of(nrs_request_resource(nrq),
struct nrs_tbf_client, tc_res);
struct nrs_tbf_head *head;
struct nrs_tbf_client *cli;
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
cli = container_of(nrs_request_resource(nrq),
struct nrs_tbf_client, tc_res);
struct ptlrpc_request *req = container_of(nrq, struct ptlrpc_request,
rq_nrq);
- LASSERT(spin_is_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock));
+ assert_spin_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
CDEBUG(D_RPCTRACE, "NRS stop %s request from %s, seq: "LPU64"\n",
policy->pol_desc->pd_name, libcfs_id2str(req->rq_peer),
if (svc->srv_procroot == NULL)
return;
- lprocfs_remove_proc_entry("nrs_tbf_quantum", svc->srv_procroot);
+ lprocfs_remove_proc_entry("nrs_tbf_rule", svc->srv_procroot);
}
#endif /* LPROCFS */