X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs_orr.c;h=97be95000465880a455fbb1a0e66f529aa138bfe;hb=14ff7815a4658d3c626d5fbdb975659966b5aee4;hp=46b439264d8f27897ea7e111d57c08623dc42501;hpb=2b294992edce5af7b79d4300ed3aa1ea6a8db850;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c index 46b4392..97be950 100644 --- a/lustre/ptlrpc/nrs_orr.c +++ b/lustre/ptlrpc/nrs_orr.c @@ -154,6 +154,10 @@ static int nrs_orr_key_fill(struct nrs_orr_data *orrd, return 0; } + /* Bounce unconnected requests to the default policy. */ + if (req->rq_export == NULL) + return -ENOTCONN; + if (nrq->nr_u.orr.or_orr_set || nrq->nr_u.orr.or_trr_set) memset(&nrq->nr_u.orr.or_key, 0, sizeof(nrq->nr_u.orr.or_key)); @@ -196,9 +200,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].rnb_offset & 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) | ~CFS_PAGE_MASK; + nb[niocount - 1].rnb_len - 1) | ~PAGE_MASK; } /** @@ -228,18 +232,18 @@ static int nrs_orr_range_fill_physical(struct ptlrpc_nrs_request *nrq, struct ptlrpc_request *req = container_of(nrq, struct ptlrpc_request, rq_nrq); - char fiemap_buf[offsetof(struct ll_user_fiemap, + char fiemap_buf[offsetof(struct fiemap, fm_extents[ORR_NUM_EXTENTS])]; - struct ll_user_fiemap *fiemap = (struct ll_user_fiemap *)fiemap_buf; + struct fiemap *fiemap = (struct fiemap *)fiemap_buf; struct ll_fiemap_info_key key; loff_t start; loff_t end; int rc; key = (typeof(key)) { - .name = KEY_FIEMAP, - .oa = *oa, - .fiemap = { + .lfik_name = KEY_FIEMAP, + .lfik_oa = *oa, + .lfik_fiemap = { .fm_start = range->or_start, .fm_length = range->or_end - range->or_start, .fm_extent_count = ORR_NUM_EXTENTS @@ -247,7 +251,7 @@ static int nrs_orr_range_fill_physical(struct ptlrpc_nrs_request *nrq, }; rc = obd_get_info(req->rq_svc_thread->t_env, req->rq_export, - sizeof(key), &key, NULL, fiemap, NULL); + sizeof(key), &key, NULL, fiemap); if (rc < 0) GOTO(out, rc); @@ -384,7 +388,8 @@ static void nrs_orr_genobjname(struct ptlrpc_nrs_policy *policy, char *name) #define NRS_TRR_BKT_BITS 2 #define NRS_TRR_HASH_FLAGS CFS_HASH_SPIN_BKTLOCK -static unsigned nrs_orr_hop_hash(cfs_hash_t *hs, const void *key, unsigned mask) +static unsigned +nrs_orr_hop_hash(struct cfs_hash *hs, const void *key, unsigned mask) { return cfs_hash_djb2_hash(key, sizeof(struct nrs_orr_key), mask); } @@ -412,7 +417,7 @@ static void *nrs_orr_hop_object(struct hlist_node *hnode) return hlist_entry(hnode, struct nrs_orr_object, oo_hnode); } -static void nrs_orr_hop_get(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_orr_hop_get(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, @@ -424,14 +429,14 @@ static void nrs_orr_hop_get(cfs_hash_t *hs, struct hlist_node *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, struct hlist_node *hnode) +static void nrs_orr_hop_put_free(struct cfs_hash *hs, struct hlist_node *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, struct nrs_orr_data, od_res); - cfs_hash_bd_t bd; + struct cfs_hash_bd bd; cfs_hash_bd_get_and_lock(hs, &orro->oo_key, &bd, 1); @@ -448,7 +453,7 @@ static void nrs_orr_hop_put_free(cfs_hash_t *hs, struct hlist_node *hnode) OBD_SLAB_FREE_PTR(orro, orrd->od_cache); } -static void nrs_orr_hop_put(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_orr_hop_put(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, @@ -465,7 +470,7 @@ static int nrs_trr_hop_keycmp(const void *key, struct hlist_node *hnode) return orro->oo_key.ok_idx == ((struct nrs_orr_key *)key)->ok_idx; } -static void nrs_trr_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode) +static void nrs_trr_hop_exit(struct cfs_hash *hs, struct hlist_node *hnode) { struct nrs_orr_object *orro = hlist_entry(hnode, struct nrs_orr_object, @@ -480,7 +485,7 @@ static void nrs_trr_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode) OBD_SLAB_FREE_PTR(orro, orrd->od_cache); } -static cfs_hash_ops_t nrs_orr_hash_ops = { +static struct cfs_hash_ops nrs_orr_hash_ops = { .hs_hash = nrs_orr_hop_hash, .hs_key = nrs_orr_hop_key, .hs_keycmp = nrs_orr_hop_keycmp, @@ -490,7 +495,7 @@ static cfs_hash_ops_t nrs_orr_hash_ops = { .hs_put_locked = nrs_orr_hop_put, }; -static cfs_hash_ops_t nrs_trr_hash_ops = { +static struct cfs_hash_ops nrs_trr_hash_ops = { .hs_hash = nrs_orr_hop_hash, .hs_key = nrs_orr_hop_key, .hs_keycmp = nrs_trr_hop_keycmp, @@ -612,7 +617,7 @@ static int nrs_orr_init(struct ptlrpc_nrs_policy *policy) static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg) { struct nrs_orr_data *orrd; - cfs_hash_ops_t *ops; + struct cfs_hash_ops *ops; unsigned cur_bits; unsigned max_bits; unsigned bkt_bits; @@ -688,10 +693,8 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg) RETURN(rc); failed: - if (orrd->od_cache) { + if (orrd->od_cache) kmem_cache_destroy(orrd->od_cache); - LASSERTF(rc == 0, "Could not destroy od_cache slab\n"); - } if (orrd->od_binheap != NULL) cfs_binheap_destroy(orrd->od_binheap); @@ -1161,7 +1164,7 @@ 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 @@ -1858,7 +1861,7 @@ 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,7 +1879,7 @@ static 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); } static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc) @@ -1889,7 +1892,7 @@ static 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 +1905,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 +1924,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 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,9 +1948,7 @@ static 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); } static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc) @@ -1961,7 +1961,7 @@ static 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 +1977,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