*
*/
-#ifdef HAVE_SERVER_SUPPORT
-
/**
* \addtogoup nrs
* @{
cli->tc_rule_generation = rule->tr_generation;
if (cli->tc_in_heap)
- cfs_binheap_relocate(head->th_binheap,
- &cli->tc_node);
+ binheap_relocate(head->th_binheap,
+ &cli->tc_node);
}
static void
* \retval 1 e1 < e2
*/
static int
-tbf_cli_compare(struct cfs_binheap_node *e1, struct cfs_binheap_node *e2)
+tbf_cli_compare(struct binheap_node *e1, struct binheap_node *e2)
{
struct nrs_tbf_client *cli1;
struct nrs_tbf_client *cli2;
/**
* TBF binary heap operations
*/
-static struct cfs_binheap_ops nrs_tbf_heap_ops = {
+static struct binheap_ops nrs_tbf_heap_ops = {
.hop_enter = NULL,
.hop_exit = NULL,
.hop_compare = tbf_cli_compare,
if (hnode == NULL)
return NULL;
- cli = container_of0(hnode, struct nrs_tbf_client, tc_hnode);
+ cli = container_of(hnode, struct nrs_tbf_client, tc_hnode);
if (!list_empty(&cli->tc_lru))
list_del_init(&cli->tc_lru);
return cli;
cfs_hash_bd_unlock(head->th_cli_hash, &bd, 1);
while (!list_empty(&zombies)) {
- cli = container_of0(zombies.next,
- struct nrs_tbf_client, tc_lru);
+ cli = container_of(zombies.next,
+ struct nrs_tbf_client, tc_lru);
list_del_init(&cli->tc_lru);
nrs_tbf_cli_fini(cli);
}
if (hnode == NULL)
return NULL;
- cli = container_of0(hnode, struct nrs_tbf_client, tc_hnode);
+ cli = container_of(hnode, struct nrs_tbf_client, tc_hnode);
if (!list_empty(&cli->tc_lru))
list_del_init(&cli->tc_lru);
return cli;
cfs_hash_bd_unlock(head->th_cli_hash, &bd, 1);
while (!list_empty(&zombies)) {
- cli = container_of0(zombies.next,
- struct nrs_tbf_client, tc_lru);
+ cli = container_of(zombies.next,
+ struct nrs_tbf_client, tc_lru);
list_del_init(&cli->tc_lru);
nrs_tbf_cli_fini(cli);
}
if (head->th_cli_hash == NULL)
return -ENOMEM;
- start.u.tc_start.ts_opcodes = NULL;
start.u.tc_start.ts_opcodes_str = "*";
start.u.tc_start.ts_rpc_rate = tbf_rate;
break;
}
- if (rc == 0)
+ if (rc == 0 && bitmaptr)
*bitmaptr = opcodes;
else
CFS_FREE_BITMAP(opcodes);
static void nrs_tbf_opcode_cmd_fini(struct nrs_tbf_cmd *cmd)
{
- if (cmd->u.tc_start.ts_opcodes)
- CFS_FREE_BITMAP(cmd->u.tc_start.ts_opcodes);
-
if (cmd->u.tc_start.ts_opcodes_str)
OBD_FREE(cmd->u.tc_start.ts_opcodes_str,
strlen(cmd->u.tc_start.ts_opcodes_str) + 1);
/* parse opcode list */
rc = nrs_tbf_opcode_list_parse(cmd->u.tc_start.ts_opcodes_str,
strlen(cmd->u.tc_start.ts_opcodes_str),
- &cmd->u.tc_start.ts_opcodes);
+ NULL);
if (rc)
nrs_tbf_opcode_cmd_fini(cmd);
strlen(start->u.tc_start.ts_opcodes_str) + 1);
/* Default rule '*' */
- if (start->u.tc_start.ts_opcodes == NULL)
+ if (strcmp(start->u.tc_start.ts_opcodes_str, "*") == 0)
return 0;
rc = nrs_tbf_opcode_list_parse(rule->tr_opcodes_str,
head->th_ops = ops;
head->th_type_flag = type;
- head->th_binheap = cfs_binheap_create(&nrs_tbf_heap_ops,
- CBH_FLAG_ATOMIC_GROW, 4096, NULL,
- nrs_pol2cptab(policy),
- nrs_pol2cptid(policy));
+ head->th_binheap = binheap_create(&nrs_tbf_heap_ops,
+ CBH_FLAG_ATOMIC_GROW, 4096, NULL,
+ nrs_pol2cptab(policy),
+ nrs_pol2cptid(policy));
if (head->th_binheap == NULL)
GOTO(out_free_head, rc = -ENOMEM);
policy->pol_private = head;
return 0;
out_free_heap:
- cfs_binheap_destroy(head->th_binheap);
+ binheap_destroy(head->th_binheap);
out_free_head:
OBD_FREE_PTR(head);
out:
}
LASSERT(list_empty(&head->th_list));
LASSERT(head->th_binheap != NULL);
- LASSERT(cfs_binheap_is_empty(head->th_binheap));
- cfs_binheap_destroy(head->th_binheap);
+ LASSERT(binheap_is_empty(head->th_binheap));
+ binheap_destroy(head->th_binheap);
OBD_FREE_PTR(head);
nrs->nrs_throttling = 0;
wake_up(&policy->pol_nrs->nrs_svcpt->scp_waitq);
struct nrs_tbf_head *head = policy->pol_private;
struct ptlrpc_nrs_request *nrq = NULL;
struct nrs_tbf_client *cli;
- struct cfs_binheap_node *node;
+ struct binheap_node *node;
assert_spin_locked(&policy->pol_nrs->nrs_svcpt->scp_req_lock);
if (!peek && policy->pol_nrs->nrs_throttling)
return NULL;
- node = cfs_binheap_root(head->th_binheap);
+ node = binheap_root(head->th_binheap);
if (unlikely(node == NULL))
return NULL;
cli->tc_check_time = now;
list_del_init(&nrq->nr_u.tbf.tr_list);
if (list_empty(&cli->tc_list)) {
- cfs_binheap_remove(head->th_binheap,
- &cli->tc_node);
+ binheap_remove(head->th_binheap,
+ &cli->tc_node);
cli->tc_in_heap = false;
} else {
if (!(rule->tr_flags & NTRS_REALTIME))
cli->tc_deadline = now + cli->tc_nsecs;
- cfs_binheap_relocate(head->th_binheap,
- &cli->tc_node);
+ binheap_relocate(head->th_binheap,
+ &cli->tc_node);
}
CDEBUG(D_RPCTRACE,
"TBF dequeues: class@%p rate %u gen %llu "
if (rule->tr_flags & NTRS_REALTIME) {
cli->tc_deadline = deadline;
cli->tc_nsecs_resid = old_resid;
- cfs_binheap_relocate(head->th_binheap,
- &cli->tc_node);
- if (node != cfs_binheap_root(head->th_binheap))
+ binheap_relocate(head->th_binheap,
+ &cli->tc_node);
+ if (node != binheap_root(head->th_binheap))
return nrs_tbf_req_get(policy,
peek, force);
}
if (list_empty(&cli->tc_list)) {
LASSERT(!cli->tc_in_heap);
cli->tc_deadline = cli->tc_check_time + cli->tc_nsecs;
- rc = cfs_binheap_insert(head->th_binheap, &cli->tc_node);
+ rc = binheap_insert(head->th_binheap, &cli->tc_node);
if (rc == 0) {
cli->tc_in_heap = true;
nrq->nr_u.tbf.tr_sequence = head->th_sequence++;
LASSERT(!list_empty(&nrq->nr_u.tbf.tr_list));
list_del_init(&nrq->nr_u.tbf.tr_list);
if (list_empty(&cli->tc_list)) {
- cfs_binheap_remove(head->th_binheap,
- &cli->tc_node);
+ binheap_remove(head->th_binheap,
+ &cli->tc_node);
cli->tc_in_heap = false;
} else {
- cfs_binheap_relocate(head->th_binheap,
- &cli->tc_node);
+ binheap_relocate(head->th_binheap,
+ &cli->tc_node);
}
}
*/
static int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc)
{
- struct lprocfs_vars nrs_tbf_lprocfs_vars[] = {
+ struct ldebugfs_vars nrs_tbf_lprocfs_vars[] = {
{ .name = "nrs_tbf_rule",
.fops = &ptlrpc_lprocfs_nrs_tbf_rule_fops,
.data = svc },
/** @} tbf */
/** @} nrs */
-
-#endif /* HAVE_SERVER_SUPPORT */