Fixed bugs which cause errors on Clang.
The majority of changes involve adding
defines for the 'ptlrpc_nrs_ctl' enum.
This avoids having to explicitly cast
enums from one type to another.
An unused variable 'req' was removed from
'nrs_tbf_req_get'. A 'strlcpy' in
'sptlrpc_process_config' was copying the
wrong number of bytes. Another variable,
'rc' in 'sptlrpc_lproc_init', seemed to
be neglected unintentionally; this was also
fixed.
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: If994c625199b392198f944f9cd21bbf2142bce69
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49859
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
* Policies can start using opcodes from this value and onwards for
* their own purposes; the assigned value itself is arbitrary.
*/
- PTLRPC_NRS_CTL_1ST_POL_SPEC = 0x20,
+ PTLRPC_NRS_CTL_POL_SPEC_01 = 0x20,
+ PTLRPC_NRS_CTL_POL_SPEC_02,
+ PTLRPC_NRS_CTL_POL_SPEC_03,
+ PTLRPC_NRS_CTL_POL_SPEC_04,
+ PTLRPC_NRS_CTL_POL_SPEC_05,
+ PTLRPC_NRS_CTL_POL_SPEC_06,
+ PTLRPC_NRS_CTL_POL_SPEC_07,
+ PTLRPC_NRS_CTL_POL_SPEC_08,
+ PTLRPC_NRS_CTL_POL_SPEC_09,
+ PTLRPC_NRS_CTL_POL_SPEC_10
};
/**
/**
* CRR-N policy operations.
+ *
+ * Read the RR quantum size of a CRR-N policy.
*/
-enum nrs_ctl_crr {
- /**
- * Read the RR quantum size of a CRR-N policy.
- */
- NRS_CTL_CRRN_RD_QUANTUM = PTLRPC_NRS_CTL_1ST_POL_SPEC,
- /**
- * Write the RR quantum size of a CRR-N policy.
- */
- NRS_CTL_CRRN_WR_QUANTUM,
-};
+#define NRS_CTL_CRRN_RD_QUANTUM PTLRPC_NRS_CTL_POL_SPEC_01
+/**
+ * Write the RR quantum size of a CRR-N policy.
+ */
+#define NRS_CTL_CRRN_WR_QUANTUM PTLRPC_NRS_CTL_POL_SPEC_02
/** @} CRR-N */
#endif
time64_t req_start_time;
};
-enum nrs_ctl_delay {
- NRS_CTL_DELAY_RD_MIN = PTLRPC_NRS_CTL_1ST_POL_SPEC,
- NRS_CTL_DELAY_WR_MIN,
- NRS_CTL_DELAY_RD_MAX,
- NRS_CTL_DELAY_WR_MAX,
- NRS_CTL_DELAY_RD_PCT,
- NRS_CTL_DELAY_WR_PCT,
-};
+#define NRS_CTL_DELAY_RD_MIN PTLRPC_NRS_CTL_POL_SPEC_01
+#define NRS_CTL_DELAY_WR_MIN PTLRPC_NRS_CTL_POL_SPEC_02
+#define NRS_CTL_DELAY_RD_MAX PTLRPC_NRS_CTL_POL_SPEC_03
+#define NRS_CTL_DELAY_WR_MAX PTLRPC_NRS_CTL_POL_SPEC_04
+#define NRS_CTL_DELAY_RD_PCT PTLRPC_NRS_CTL_POL_SPEC_05
+#define NRS_CTL_DELAY_WR_PCT PTLRPC_NRS_CTL_POL_SPEC_06
/** @} delay */
/**
* ORR policy operations
*/
-enum nrs_ctl_orr {
- NRS_CTL_ORR_RD_QUANTUM = PTLRPC_NRS_CTL_1ST_POL_SPEC,
- NRS_CTL_ORR_WR_QUANTUM,
- NRS_CTL_ORR_RD_OFF_TYPE,
- NRS_CTL_ORR_WR_OFF_TYPE,
- NRS_CTL_ORR_RD_SUPP_REQ,
- NRS_CTL_ORR_WR_SUPP_REQ,
-};
+#define NRS_CTL_ORR_RD_QUANTUM PTLRPC_NRS_CTL_POL_SPEC_01
+#define NRS_CTL_ORR_WR_QUANTUM PTLRPC_NRS_CTL_POL_SPEC_02
+#define NRS_CTL_ORR_RD_OFF_TYPE PTLRPC_NRS_CTL_POL_SPEC_03
+#define NRS_CTL_ORR_WR_OFF_TYPE PTLRPC_NRS_CTL_POL_SPEC_04
+#define NRS_CTL_ORR_RD_SUPP_REQ PTLRPC_NRS_CTL_POL_SPEC_05
+#define NRS_CTL_ORR_WR_SUPP_REQ PTLRPC_NRS_CTL_POL_SPEC_06
/**
* \name ORR/TRR
/**
* TBF policy operations.
+ *
+ * Read the the data of a TBF policy.
*/
-enum nrs_ctl_tbf {
- /**
- * Read the the data of a TBF policy.
- */
- NRS_CTL_TBF_RD_RULE = PTLRPC_NRS_CTL_1ST_POL_SPEC,
- /**
- * Write the the data of a TBF policy.
- */
- NRS_CTL_TBF_WR_RULE,
- /**
- * Read the TBF policy type preset by proc entry "nrs_policies".
- */
- NRS_CTL_TBF_RD_TYPE_FLAG,
-};
+#define NRS_CTL_TBF_RD_RULE PTLRPC_NRS_CTL_POL_SPEC_01
+/**
+ * Write the the data of a TBF policy.
+ */
+#define NRS_CTL_TBF_WR_RULE PTLRPC_NRS_CTL_POL_SPEC_02
+/**
+ * Read the TBF policy type preset by proc entry "nrs_policies".
+ */
+#define NRS_CTL_TBF_RD_TYPE_FLAG PTLRPC_NRS_CTL_POL_SPEC_03
/** @} tbf */
#endif
{
assert_spin_locked(&policy->pol_nrs->nrs_lock);
- switch((enum nrs_ctl_crr)opc) {
+ switch (opc) {
default:
RETURN(-EINVAL);
assert_spin_locked(&policy->pol_nrs->nrs_lock);
- switch ((enum nrs_ctl_delay)opc) {
+ switch (opc) {
default:
RETURN(-EINVAL);
{
assert_spin_locked(&policy->pol_nrs->nrs_lock);
- switch((enum nrs_ctl_orr)opc) {
+ switch (opc) {
default:
RETURN(-EINVAL);
assert_spin_locked(&policy->pol_nrs->nrs_lock);
- switch ((enum nrs_ctl_tbf)opc) {
+ switch (opc) {
default:
RETURN(-EINVAL);
ntoken = 1;
if (ntoken > 0) {
- struct ptlrpc_request *req;
nrq = list_entry(cli->tc_list.next,
- struct ptlrpc_nrs_request,
- nr_u.tbf.tr_list);
- req = container_of(nrq,
- struct ptlrpc_request,
- rq_nrq);
+ struct ptlrpc_nrs_request,
+ nr_u.tbf.tr_list);
ntoken--;
cli->tc_ntoken = ntoken;
cli->tc_check_time = now;
* is a actual filesystem.
*/
if (server_name2fsname(target, fsname, NULL))
- strlcpy(fsname, target, sizeof(target));
+ strlcpy(fsname, target, sizeof(fsname));
rc = sptlrpc_parse_rule(param, &rule);
if (rc)
int sptlrpc_lproc_init(void)
{
- int rc;
+ int rc = 0;
LASSERT(sptlrpc_debugfs_dir == NULL);
: -ENOMEM;
sptlrpc_lprocfs_dir = NULL;
}
- return 0;
+ return rc;
}
void sptlrpc_lproc_fini(void)