From 8c19d5147dba92a79cbcb8eb74a7bf3eecd77133 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Wed, 29 Apr 2020 12:46:43 +1000 Subject: [PATCH] LU-9679 nrs: remove ts_opcodes bitmap. This bitmap is never used. There is one place that tests if it has been allocated or not, but that place can easily be satisfied by a strcmp(). So discard the field. Signed-off-by: Mr NeilBrown Change-Id: I97ca6753236f106d1865d514034b72a679f9b28a Reviewed-on: https://review.whamcloud.com/38975 Tested-by: jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/lustre_nrs_tbf.h | 1 - lustre/ptlrpc/nrs_tbf.c | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lustre/include/lustre_nrs_tbf.h b/lustre/include/lustre_nrs_tbf.h index 7141146..e4bbf8a 100644 --- a/lustre/include/lustre_nrs_tbf.h +++ b/lustre/include/lustre_nrs_tbf.h @@ -306,7 +306,6 @@ struct nrs_tbf_cmd { char *ts_jobids_str; struct list_head ts_ids; char *ts_ids_str; - struct cfs_bitmap *ts_opcodes; char *ts_opcodes_str; struct list_head ts_conds; char *ts_conds_str; diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index d28c11d..76c8e4cd 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -2182,7 +2182,6 @@ nrs_tbf_opcode_startup(struct ptlrpc_nrs_policy *policy, if (head->th_cli_hash == NULL) return -ENOMEM; - start.u.tc_start.ts_opcodes = NULL; start.u.tc_start.ts_opcodes_str = "*"; start.u.tc_start.ts_rpc_rate = tbf_rate; @@ -2265,7 +2264,7 @@ nrs_tbf_opcode_list_parse(char *str, int len, struct cfs_bitmap **bitmaptr) break; } - if (rc == 0) + if (rc == 0 && bitmaptr) *bitmaptr = opcodes; else CFS_FREE_BITMAP(opcodes); @@ -2275,9 +2274,6 @@ nrs_tbf_opcode_list_parse(char *str, int len, struct cfs_bitmap **bitmaptr) static void nrs_tbf_opcode_cmd_fini(struct nrs_tbf_cmd *cmd) { - if (cmd->u.tc_start.ts_opcodes) - CFS_FREE_BITMAP(cmd->u.tc_start.ts_opcodes); - if (cmd->u.tc_start.ts_opcodes_str) OBD_FREE(cmd->u.tc_start.ts_opcodes_str, strlen(cmd->u.tc_start.ts_opcodes_str) + 1); @@ -2304,7 +2300,7 @@ static int nrs_tbf_opcode_parse(struct nrs_tbf_cmd *cmd, char *id) /* parse opcode list */ rc = nrs_tbf_opcode_list_parse(cmd->u.tc_start.ts_opcodes_str, strlen(cmd->u.tc_start.ts_opcodes_str), - &cmd->u.tc_start.ts_opcodes); + NULL); if (rc) nrs_tbf_opcode_cmd_fini(cmd); @@ -2337,7 +2333,7 @@ static int nrs_tbf_opcode_rule_init(struct ptlrpc_nrs_policy *policy, strlen(start->u.tc_start.ts_opcodes_str) + 1); /* Default rule '*' */ - if (start->u.tc_start.ts_opcodes == NULL) + if (strcmp(start->u.tc_start.ts_opcodes_str, "*") == 0) return 0; rc = nrs_tbf_opcode_list_parse(rule->tr_opcodes_str, -- 1.8.3.1