X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs_delay.c;h=0f1459b7fd7aaf75899967b1ec48d7e22748ecf2;hb=ab6c8bd18e1441f803a6b090a555eb30b1c527b7;hp=936782c4eb964e163a458ea01957eff40764b9e5;hpb=dd392dfbfb1a71423f18166a56e43d9234c739d7;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nrs_delay.c b/lustre/ptlrpc/nrs_delay.c index 936782c..0f1459b 100644 --- a/lustre/ptlrpc/nrs_delay.c +++ b/lustre/ptlrpc/nrs_delay.c @@ -76,8 +76,8 @@ * \retval 0 start_time(e1) > start_time(e2) * \retval 1 start_time(e1) <= start_time(e2) */ -static int delay_req_compare(struct cfs_binheap_node *e1, - struct cfs_binheap_node *e2) +static int delay_req_compare(struct binheap_node *e1, + struct binheap_node *e2) { struct ptlrpc_nrs_request *nrq1; struct ptlrpc_nrs_request *nrq2; @@ -89,7 +89,7 @@ static int delay_req_compare(struct cfs_binheap_node *e1, nrq2->nr_u.delay.req_start_time; } -static struct cfs_binheap_ops nrs_delay_heap_ops = { +static struct binheap_ops nrs_delay_heap_ops = { .hop_enter = NULL, .hop_exit = NULL, .hop_compare = delay_req_compare, @@ -120,7 +120,7 @@ static int nrs_delay_start(struct ptlrpc_nrs_policy *policy, char *arg) if (delay_data == NULL) RETURN(-ENOMEM); - delay_data->delay_binheap = cfs_binheap_create(&nrs_delay_heap_ops, + delay_data->delay_binheap = binheap_create(&nrs_delay_heap_ops, CBH_FLAG_ATOMIC_GROW, 4096, NULL, nrs_pol2cptab(policy), @@ -155,9 +155,9 @@ static void nrs_delay_stop(struct ptlrpc_nrs_policy *policy) LASSERT(delay_data != NULL); LASSERT(delay_data->delay_binheap != NULL); - LASSERT(cfs_binheap_is_empty(delay_data->delay_binheap)); + LASSERT(binheap_is_empty(delay_data->delay_binheap)); - cfs_binheap_destroy(delay_data->delay_binheap); + binheap_destroy(delay_data->delay_binheap); OBD_FREE_PTR(delay_data); } @@ -212,10 +212,10 @@ struct ptlrpc_nrs_request *nrs_delay_req_get(struct ptlrpc_nrs_policy *policy, bool peek, bool force) { struct nrs_delay_data *delay_data = policy->pol_private; - struct cfs_binheap_node *node; + struct binheap_node *node; struct ptlrpc_nrs_request *nrq; - node = cfs_binheap_root(delay_data->delay_binheap); + node = binheap_root(delay_data->delay_binheap); nrq = unlikely(node == NULL) ? NULL : container_of(node, struct ptlrpc_nrs_request, nr_node); @@ -224,7 +224,7 @@ struct ptlrpc_nrs_request *nrs_delay_req_get(struct ptlrpc_nrs_policy *policy, ktime_get_real_seconds() < nrq->nr_u.delay.req_start_time) nrq = NULL; else if (likely(!peek)) - cfs_binheap_remove(delay_data->delay_binheap, + binheap_remove(delay_data->delay_binheap, &nrq->nr_node); } @@ -255,14 +255,14 @@ static int nrs_delay_req_add(struct ptlrpc_nrs_policy *policy, if (delay_data->delay_pct == 0 || /* Not delaying anything */ (delay_data->delay_pct != 100 && - delay_data->delay_pct < prandom_u32_max(100))) + delay_data->delay_pct < get_random_u32_below(100))) return 1; nrq->nr_u.delay.req_start_time = ktime_get_real_seconds() + - prandom_u32_max(delay_data->max_delay - delay_data->min_delay + 1) + + get_random_u32_below(delay_data->max_delay - delay_data->min_delay + 1) + delay_data->min_delay; - return cfs_binheap_insert(delay_data->delay_binheap, &nrq->nr_node); + return binheap_insert(delay_data->delay_binheap, &nrq->nr_node); } /** @@ -276,7 +276,7 @@ static void nrs_delay_req_del(struct ptlrpc_nrs_policy *policy, { struct nrs_delay_data *delay_data = policy->pol_private; - cfs_binheap_remove(delay_data->delay_binheap, &nrq->nr_node); + binheap_remove(delay_data->delay_binheap, &nrq->nr_node); } /** @@ -297,7 +297,7 @@ static void nrs_delay_req_stop(struct ptlrpc_nrs_policy *policy, DEBUG_REQ(D_RPCTRACE, req, "NRS: finished delayed request from %s after %llds", - libcfs_id2str(req->rq_peer), + libcfs_idstr(&req->rq_peer), (s64)(nrq->nr_u.delay.req_start_time - req->rq_srv.sr_arrival_time.tv_sec)); } @@ -323,7 +323,7 @@ static int nrs_delay_ctl(struct ptlrpc_nrs_policy *policy, assert_spin_locked(&policy->pol_nrs->nrs_lock); - switch ((enum nrs_ctl_delay)opc) { + switch (opc) { default: RETURN(-EINVAL); @@ -779,7 +779,7 @@ LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_delay_pct); static int nrs_delay_lprocfs_init(struct ptlrpc_service *svc) { - struct lprocfs_vars nrs_delay_lprocfs_vars[] = { + struct ldebugfs_vars nrs_delay_lprocfs_vars[] = { { .name = "nrs_delay_min", .fops = &ptlrpc_lprocfs_nrs_delay_min_fops, .data = svc },