X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs_orr.c;h=9b8ad5dc2e56f5b150ce6243b4577f1d66bf0d00;hp=6d54e6da20d4119c3cb8912be123694cac664540;hb=c56f7675bfb17b3847b38044153e86550ced3c8e;hpb=cc2ff1bfd66a5c004eb6ed61fc2dac3f1ab49d3a diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c index 6d54e6d..9b8ad5d 100644 --- a/lustre/ptlrpc/nrs_orr.c +++ b/lustre/ptlrpc/nrs_orr.c @@ -20,7 +20,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2013, Intel Corporation. + * Copyright (c) 2013, 2014, Intel Corporation. * * Copyright 2012 Xyratex Technology Limited */ @@ -196,9 +196,9 @@ static void nrs_orr_range_fill_logical(struct niobuf_remote *nb, int niocount, struct nrs_orr_req_range *range) { /* Should we do this at page boundaries ? */ - range->or_start = nb[0].offset & CFS_PAGE_MASK; - range->or_end = (nb[niocount - 1].offset + - nb[niocount - 1].len - 1) | ~CFS_PAGE_MASK; + range->or_start = nb[0].rnb_offset & PAGE_MASK; + range->or_end = (nb[niocount - 1].rnb_offset + + nb[niocount - 1].rnb_len - 1) | ~PAGE_MASK; } /** @@ -389,17 +389,17 @@ static unsigned nrs_orr_hop_hash(cfs_hash_t *hs, const void *key, unsigned mask) return cfs_hash_djb2_hash(key, sizeof(struct nrs_orr_key), mask); } -static void *nrs_orr_hop_key(cfs_hlist_node_t *hnode) +static void *nrs_orr_hop_key(struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); return &orro->oo_key; } -static int nrs_orr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode) +static int nrs_orr_hop_keycmp(const void *key, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); @@ -407,14 +407,14 @@ static int nrs_orr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode) &((struct nrs_orr_key *)key)->ok_fid); } -static void *nrs_orr_hop_object(cfs_hlist_node_t *hnode) +static void *nrs_orr_hop_object(struct hlist_node *hnode) { - return cfs_hlist_entry(hnode, struct nrs_orr_object, oo_hnode); + return hlist_entry(hnode, struct nrs_orr_object, oo_hnode); } -static void nrs_orr_hop_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +static void nrs_orr_hop_get(cfs_hash_t *hs, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); orro->oo_ref++; @@ -424,9 +424,9 @@ static void nrs_orr_hop_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode) * Removes an nrs_orr_object the hash and frees its memory, if the object has * no active users. */ -static void nrs_orr_hop_put_free(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +static void nrs_orr_hop_put_free(cfs_hash_t *hs, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); struct nrs_orr_data *orrd = container_of(orro->oo_res.res_parent, @@ -448,26 +448,26 @@ static void nrs_orr_hop_put_free(cfs_hash_t *hs, cfs_hlist_node_t *hnode) OBD_SLAB_FREE_PTR(orro, orrd->od_cache); } -static void nrs_orr_hop_put(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +static void nrs_orr_hop_put(cfs_hash_t *hs, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); orro->oo_ref--; } -static int nrs_trr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode) +static int nrs_trr_hop_keycmp(const void *key, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); return orro->oo_key.ok_idx == ((struct nrs_orr_key *)key)->ok_idx; } -static void nrs_trr_hop_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +static void nrs_trr_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode) { - struct nrs_orr_object *orro = cfs_hlist_entry(hnode, + struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, oo_hnode); struct nrs_orr_data *orrd = container_of(orro->oo_res.res_parent, @@ -741,8 +741,8 @@ static void nrs_orr_stop(struct ptlrpc_nrs_policy *policy) * \retval 0 operation carried successfully * \retval -ve error */ -int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc, - void *arg) +static int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, + enum ptlrpc_nrs_ctl opc, void *arg) { assert_spin_locked(&policy->pol_nrs->nrs_lock); @@ -819,10 +819,10 @@ int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc, * * \see nrs_resource_get_safe() */ -int nrs_orr_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_orr_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_orr_data *orrd; struct nrs_orr_object *orro; @@ -1161,14 +1161,14 @@ static void nrs_orr_req_stop(struct ptlrpc_nrs_policy *policy, * lprocfs interface */ -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS /** * This allows to bundle the policy name into the lprocfs_vars::data pointer * so that lprocfs read/write functions can be used by both the ORR and TRR * policies. */ -struct nrs_lprocfs_orr_data { +static struct nrs_lprocfs_orr_data { struct ptlrpc_service *svc; char *name; } lprocfs_orr_data = { @@ -1854,11 +1854,11 @@ ptlrpc_lprocfs_nrs_orr_supported_seq_write(struct file *file, } LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported); -int nrs_orr_lprocfs_init(struct ptlrpc_service *svc) +static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc) { int i; - struct lprocfs_seq_vars nrs_orr_lprocfs_vars[] = { + struct lprocfs_vars nrs_orr_lprocfs_vars[] = { { .name = "nrs_orr_quantum", .fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops }, { .name = "nrs_orr_offset_type", @@ -1876,10 +1876,10 @@ int nrs_orr_lprocfs_init(struct ptlrpc_service *svc) for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++) nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data; - return lprocfs_seq_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL); + return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL); } -void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc) +static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc) { if (svc->srv_procroot == NULL) return; @@ -1889,7 +1889,7 @@ void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc) lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot); } -#endif /* LPROCFS */ +#endif /* CONFIG_PROC_FS */ static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = { .op_policy_init = nrs_orr_init, @@ -1902,7 +1902,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = { .op_req_enqueue = nrs_orr_req_add, .op_req_dequeue = nrs_orr_req_del, .op_req_stop = nrs_orr_req_stop, -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS .op_lprocfs_init = nrs_orr_lprocfs_init, .op_lprocfs_fini = nrs_orr_lprocfs_fini, #endif @@ -1921,14 +1921,13 @@ struct ptlrpc_nrs_pol_conf nrs_conf_orr = { * TRR reuses much of the functions and data structures of ORR */ -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS -int nrs_trr_lprocfs_init(struct ptlrpc_service *svc) +static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc) { - int rc; int i; - struct lprocfs_seq_vars nrs_trr_lprocfs_vars[] = { + struct lprocfs_vars nrs_trr_lprocfs_vars[] = { { .name = "nrs_trr_quantum", .fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops }, { .name = "nrs_trr_offset_type", @@ -1946,12 +1945,10 @@ int nrs_trr_lprocfs_init(struct ptlrpc_service *svc) for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++) nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data; - rc = lprocfs_seq_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL); - - return rc; + return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL); } -void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc) +static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc) { if (svc->srv_procroot == NULL) return; @@ -1961,7 +1958,7 @@ void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc) lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot); } -#endif /* LPROCFS */ +#endif /* CONFIG_PROC_FS */ /** * Reuse much of the ORR functionality for TRR. @@ -1977,7 +1974,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_trr_ops = { .op_req_enqueue = nrs_orr_req_add, .op_req_dequeue = nrs_orr_req_del, .op_req_stop = nrs_orr_req_stop, -#ifdef LPROCFS +#ifdef CONFIG_PROC_FS .op_lprocfs_init = nrs_trr_lprocfs_init, .op_lprocfs_fini = nrs_trr_lprocfs_fini, #endif