X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs_tbf.c;h=94861726846f4be8d037c41ee4f82e0a54781dc6;hb=31170f9ceca91684ea66e0b16757881563a8cf26;hp=980cff49bc1fc2b2e5d6c4bc7d8f671243cbebd4;hpb=e0cdde123c14729a340cf937cf9580be7c9dd9c1;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 980cff4..9486172 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -807,7 +807,7 @@ nrs_tbf_jobid_list_free(struct list_head *jobid_list) list_for_each_entry_safe(jobid, n, jobid_list, tj_linkage) { OBD_FREE(jobid->tj_id, strlen(jobid->tj_id) + 1); list_del(&jobid->tj_linkage); - OBD_FREE(jobid, sizeof(struct nrs_tbf_jobid)); + OBD_FREE_PTR(jobid); } } @@ -815,22 +815,21 @@ static int nrs_tbf_jobid_list_add(struct cfs_lstr *id, struct list_head *jobid_list) { struct nrs_tbf_jobid *jobid; - struct cfs_lstr res; - int rc; + char *ptr; - OBD_ALLOC(jobid, sizeof(struct nrs_tbf_jobid)); + OBD_ALLOC_PTR(jobid); if (jobid == NULL) return -ENOMEM; OBD_ALLOC(jobid->tj_id, id->ls_len + 1); if (jobid->tj_id == NULL) { - OBD_FREE(jobid, sizeof(struct nrs_tbf_jobid)); + OBD_FREE_PTR(jobid); return -ENOMEM; } memcpy(jobid->tj_id, id->ls_str, id->ls_len); - rc = cfs_gettok(id, '*', &res); - if (rc == 0) + ptr = lprocfs_strnstr(id->ls_str, "*", id->ls_len); + if (ptr == NULL) jobid->tj_match_flag = NRS_TBF_MATCH_FULL; else jobid->tj_match_flag = NRS_TBF_MATCH_WILDCARD; @@ -1487,8 +1486,6 @@ static struct req_format *intent_req_fmt(__u32 it_opc) return &RQF_LDLM_INTENT_OPEN; else if (it_opc & (IT_GETATTR | IT_LOOKUP)) return &RQF_LDLM_INTENT_GETATTR; - else if (it_opc & IT_UNLINK) - return &RQF_LDLM_INTENT_UNLINK; else if (it_opc & IT_GETXATTR) return &RQF_LDLM_INTENT_GETXATTR; else if (it_opc & (IT_GLIMPSE | IT_BRW)) @@ -1843,7 +1840,7 @@ nrs_tbf_expression_parse(struct cfs_lstr *src, struct list_head *cond_list) struct cfs_lstr field; int rc = 0; - OBD_ALLOC(expr, sizeof(struct nrs_tbf_expression)); + OBD_ALLOC_PTR(expr); if (expr == NULL) return -ENOMEM; @@ -1906,7 +1903,7 @@ nrs_tbf_conjunction_parse(struct cfs_lstr *src, struct list_head *cond_list) struct cfs_lstr expr; int rc = 0; - OBD_ALLOC(conjunction, sizeof(struct nrs_tbf_conjunction)); + OBD_ALLOC_PTR(conjunction); if (conjunction == NULL) return -ENOMEM; @@ -3269,10 +3266,8 @@ static void nrs_tbf_req_stop(struct ptlrpc_nrs_policy *policy, nrq->nr_u.tbf.tr_sequence); } -#ifdef CONFIG_PROC_FS - /** - * lprocfs interface + * debugfs interface */ /** @@ -3588,7 +3583,6 @@ nrs_tbf_type_flag(struct ptlrpc_service *svc, enum ptlrpc_nrs_queue_type queue) return type; } -extern struct nrs_core nrs_core; #define LPROCFS_WR_NRS_TBF_MAX_CMD (4096) static ssize_t ptlrpc_lprocfs_nrs_tbf_rule_seq_write(struct file *file, @@ -3660,7 +3654,8 @@ out_free_kernbuff: out: return rc ? rc : count; } -LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule); + +LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule); /** * Initializes a TBF policy's lprocfs interface for service \a svc @@ -3679,27 +3674,13 @@ static int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc) { NULL } }; - if (svc->srv_procroot == NULL) + if (!svc->srv_debugfs_entry) return 0; - return lprocfs_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL); -} - -/** - * Cleans up a TBF policy's lprocfs interface for service \a svc - * - * \param[in] svc the service - */ -static void nrs_tbf_lprocfs_fini(struct ptlrpc_service *svc) -{ - if (svc->srv_procroot == NULL) - return; - - lprocfs_remove_proc_entry("nrs_tbf_rule", svc->srv_procroot); + return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_tbf_lprocfs_vars, + NULL); } -#endif /* CONFIG_PROC_FS */ - /** * TBF policy operations */ @@ -3713,10 +3694,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_tbf_ops = { .op_req_enqueue = nrs_tbf_req_add, .op_req_dequeue = nrs_tbf_req_del, .op_req_stop = nrs_tbf_req_stop, -#ifdef CONFIG_PROC_FS .op_lprocfs_init = nrs_tbf_lprocfs_init, - .op_lprocfs_fini = nrs_tbf_lprocfs_fini, -#endif }; /**