X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs_crr.c;h=ea5e127c71b6277bc69d8ebcbbb2f4c87475e469;hb=b18132d1201b48805503d23c4f9f403e769b27a9;hp=bf16216459fb4a1e2c157663871baf64f52e6c5d;hpb=1f1d3a376d488d715dd1b0c94d5b66ea05c1e6ca;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nrs_crr.c b/lustre/ptlrpc/nrs_crr.c index bf16216..ea5e127 100644 --- a/lustre/ptlrpc/nrs_crr.c +++ b/lustre/ptlrpc/nrs_crr.c @@ -20,7 +20,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2011 Intel Corporation + * Copyright (c) 2011, 2014, Intel Corporation. * * Copyright 2012 Xyratex Technology Limited */ @@ -72,7 +72,8 @@ * \retval 0 e1 > e2 * \retval 1 e1 <= e2 */ -static int crrn_req_compare(cfs_binheap_node_t *e1, cfs_binheap_node_t *e2) +static int +crrn_req_compare(struct cfs_binheap_node *e1, struct cfs_binheap_node *e2) { struct ptlrpc_nrs_request *nrq1; struct ptlrpc_nrs_request *nrq2; @@ -88,7 +89,7 @@ static int crrn_req_compare(cfs_binheap_node_t *e1, cfs_binheap_node_t *e2) return nrq1->nr_u.crr.cr_sequence < nrq2->nr_u.crr.cr_sequence; } -static cfs_binheap_ops_t nrs_crrn_heap_ops = { +static struct cfs_binheap_ops nrs_crrn_heap_ops = { .hop_enter = NULL, .hop_exit = NULL, .hop_compare = crrn_req_compare, @@ -103,7 +104,7 @@ static cfs_binheap_ops_t nrs_crrn_heap_ops = { #define NRS_NID_BKT_BITS 8 #define NRS_NID_BITS 16 -static unsigned nrs_crrn_hop_hash(cfs_hash_t *hs, const void *key, +static unsigned nrs_crrn_hop_hash(struct cfs_hash *hs, const void *key, unsigned mask) { return cfs_hash_djb2_hash(key, sizeof(lnet_nid_t), mask); @@ -131,7 +132,7 @@ static void *nrs_crrn_hop_object(struct hlist_node *hnode) return hlist_entry(hnode, struct nrs_crrn_client, cc_hnode); } -static void nrs_crrn_hop_get(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_crrn_hop_get(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_crrn_client *cli = hlist_entry(hnode, struct nrs_crrn_client, @@ -139,7 +140,7 @@ static void nrs_crrn_hop_get(cfs_hash_t *hs, struct hlist_node *hnode) atomic_inc(&cli->cc_ref); } -static void nrs_crrn_hop_put(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_crrn_hop_put(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_crrn_client *cli = hlist_entry(hnode, struct nrs_crrn_client, @@ -147,7 +148,7 @@ static void nrs_crrn_hop_put(cfs_hash_t *hs, struct hlist_node *hnode) atomic_dec(&cli->cc_ref); } -static void nrs_crrn_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_crrn_hop_exit(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_crrn_client *cli = hlist_entry(hnode, struct nrs_crrn_client, @@ -159,7 +160,7 @@ static void nrs_crrn_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode) OBD_FREE_PTR(cli); } -static cfs_hash_ops_t nrs_crrn_hash_ops = { +static struct cfs_hash_ops nrs_crrn_hash_ops = { .hs_hash = nrs_crrn_hop_hash, .hs_keycmp = nrs_crrn_hop_keycmp, .hs_key = nrs_crrn_hop_key, @@ -270,8 +271,9 @@ static void nrs_crrn_stop(struct ptlrpc_nrs_policy *policy) * \retval 0 operation carried out successfully * \retval -ve error */ -int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc, - void *arg) +static int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, + enum ptlrpc_nrs_ctl opc, + void *arg) { assert_spin_locked(&policy->pol_nrs->nrs_lock); @@ -326,10 +328,10 @@ int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc, * * \see nrs_resource_get_safe() */ -int nrs_crrn_res_get(struct ptlrpc_nrs_policy *policy, - struct ptlrpc_nrs_request *nrq, - const struct ptlrpc_nrs_resource *parent, - struct ptlrpc_nrs_resource **resp, bool moving_req) +static int nrs_crrn_res_get(struct ptlrpc_nrs_policy *policy, + struct ptlrpc_nrs_request *nrq, + const struct ptlrpc_nrs_resource *parent, + struct ptlrpc_nrs_resource **resp, bool moving_req) { struct nrs_crrn_net *net; struct nrs_crrn_client *cli; @@ -413,7 +415,7 @@ struct ptlrpc_nrs_request *nrs_crrn_req_get(struct ptlrpc_nrs_policy *policy, bool peek, bool force) { struct nrs_crrn_net *net = policy->pol_private; - cfs_binheap_node_t *node = cfs_binheap_root(net->cn_binheap); + struct cfs_binheap_node *node = cfs_binheap_root(net->cn_binheap); struct ptlrpc_nrs_request *nrq; nrq = unlikely(node == NULL) ? NULL : @@ -575,7 +577,7 @@ static void nrs_crrn_req_del(struct ptlrpc_nrs_policy *policy, */ if (unlikely(is_root)) { /** Peek at the next request to be served */ - cfs_binheap_node_t *node = cfs_binheap_root(net->cn_binheap); + struct cfs_binheap_node *node = cfs_binheap_root(net->cn_binheap); /** No more requests */ if (unlikely(node == NULL)) { @@ -609,7 +611,7 @@ static void nrs_crrn_req_stop(struct ptlrpc_nrs_policy *policy, libcfs_id2str(req->rq_peer), nrq->nr_u.crr.cr_round); } -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS /** * lprocfs interface @@ -699,7 +701,8 @@ no_hp: */ static ssize_t ptlrpc_lprocfs_nrs_crrn_quantum_seq_write(struct file *file, - const char *buffer, size_t count, + const char __user *buffer, + size_t count, loff_t *off) { struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private; @@ -816,9 +819,9 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_crrn_quantum); * \retval 0 success * \retval != 0 error */ -int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) +static int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) { - struct lprocfs_seq_vars nrs_crrn_lprocfs_vars[] = { + struct lprocfs_vars nrs_crrn_lprocfs_vars[] = { { .name = "nrs_crrn_quantum", .fops = &ptlrpc_lprocfs_nrs_crrn_quantum_fops, .data = svc }, @@ -828,8 +831,7 @@ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) if (svc->srv_procroot == NULL) return 0; - return lprocfs_seq_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, - NULL); + return lprocfs_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, NULL); } /** @@ -837,7 +839,7 @@ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) * * \param[in] svc the service */ -void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc) +static void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc) { if (svc->srv_procroot == NULL) return; @@ -845,7 +847,7 @@ void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc) lprocfs_remove_proc_entry("nrs_crrn_quantum", svc->srv_procroot); } -#endif /* LPROCFS */ +#endif /* CONFIG_PROC_FS */ /** * CRR-N policy operations @@ -860,7 +862,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_crrn_ops = { .op_req_enqueue = nrs_crrn_req_add, .op_req_dequeue = nrs_crrn_req_del, .op_req_stop = nrs_crrn_req_stop, -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS .op_lprocfs_init = nrs_crrn_lprocfs_init, .op_lprocfs_fini = nrs_crrn_lprocfs_fini, #endif