From b4a28a3269fadb105912325054c4ba82984a981c Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Tue, 10 May 2022 12:53:02 +1000 Subject: [PATCH] LU-10391 lustre: rename class_parse_nid to class_parse_nid4 Use the name "nid4" for class_parse_nid(), class_parse_nid_quiet(), parse_nid() and CLASS_PARSE_NID. This will allow a new class_parse_nid which handle larger nids. Signed-off-by: Mr NeilBrown Change-Id: I2766634ac55ae7bd30c72549decc1cfd99471bfd Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50088 Tested-by: jenkins Tested-by: Maloo Reviewed-by: jsimmons Reviewed-by: Frank Sehr Reviewed-by: Chris Horn Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 4 ++-- lustre/mgs/mgs_handler.c | 2 +- lustre/mgs/mgs_llog.c | 10 +++++----- lustre/obdclass/obd_config.c | 28 ++++++++++++++-------------- lustre/obdclass/obd_mount.c | 12 ++++++------ 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 4b1d04e..e59bcc4 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -174,8 +174,8 @@ struct cfg_interop_param *class_find_old_param(const char *param, struct cfg_interop_param *ptr); int class_get_next_param(char **params, char *copy); int class_match_param(char *buf, const char *key, char **valp); -int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh); -int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh); +int class_parse_nid4(char *buf, lnet_nid_t *nid4, char **endh); +int class_parse_nid4_quiet(char *buf, lnet_nid_t *nid4, char **endh); int class_parse_net(char *buf, u32 *net, char **endh); int class_match_nid(char *buf, char *key, lnet_nid_t nid); int class_match_net(char *buf, char *key, u32 net); diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index d1aba9f..20201ca 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -313,7 +313,7 @@ static int mgs_check_failover_reg(struct mgs_target_info *mti) ptr = mti->mti_params; while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) { - while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4_quiet(ptr, &nid, &ptr) == 0) { for (i = 0; i < mti->mti_nid_count; i++) { if (nid == mti->mti_nids[i]) { LCONSOLE_WARN("Denying initial registration attempt from nid %s, specified as failover\n", diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 2acf21c..009ba94 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1135,7 +1135,7 @@ static int process_command(const struct lu_env *env, struct lustre_cfg *lcfg, /* LCFG_ADD_UUID command found. Let's skip original command and add passed nids */ ptr = mrd->target.mti_params; - while (class_parse_nid(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4(ptr, &nid, &ptr) == 0) { if (!mrd->nodeuuid) { rc = name_create(&mrd->nodeuuid, libcfs_nid2str(nid), ""); @@ -1202,7 +1202,7 @@ static int process_command(const struct lu_env *env, struct lustre_cfg *lcfg, if (mrd->failover) { ptr = mrd->failover; - while (class_parse_nid(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4(ptr, &nid, &ptr) == 0) { if (mrd->nodeuuid == NULL) { rc = name_create(&mrd->nodeuuid, libcfs_nid2str(nid), @@ -2500,12 +2500,12 @@ static int mgs_write_log_failnids(const struct lu_env *env, /* * Pull failnid info out of params string, which may contain something - * like ",:,". class_parse_nid() does not + * like ",:,". class_parse_nid4() does not * complain about abnormal inputs like ",:", ":,", * etc. However, convert_hostnames() should have caught those. */ - while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) { - while (class_parse_nid(ptr, &nid, &ptr) == 0) { + while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) { + while (class_parse_nid4(ptr, &nid, &ptr) == 0) { char nidstr[LNET_NIDSTR_SIZE]; if (failnodeuuid == NULL) { diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 56dacf7..555176f 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -408,12 +408,12 @@ int class_match_param(char *buf, const char *key, char **valp) } EXPORT_SYMBOL(class_match_param); -static int parse_nid(char *buf, void *value, int quiet) +static int parse_nid4(char *buf, void *value, int quiet) { - lnet_nid_t *nid = (lnet_nid_t *)value; + lnet_nid_t *nid4 = (lnet_nid_t *)value; - *nid = libcfs_str2nid(buf); - if (*nid != LNET_NID_ANY) + *nid4 = libcfs_str2nid(buf); + if (*nid4 != LNET_NID_ANY) return 0; if (!quiet) @@ -431,7 +431,7 @@ static int parse_net(char *buf, void *value) } enum { - CLASS_PARSE_NID = 1, + CLASS_PARSE_NID4 = 1, CLASS_PARSE_NET, }; @@ -465,8 +465,8 @@ static int class_parse_value(char *buf, int opc, void *value, char **endh, switch (opc) { default: LBUG(); - case CLASS_PARSE_NID: - rc = parse_nid(buf, value, quiet); + case CLASS_PARSE_NID4: + rc = parse_nid4(buf, value, quiet); break; case CLASS_PARSE_NET: rc = parse_net(buf, value); @@ -480,17 +480,17 @@ static int class_parse_value(char *buf, int opc, void *value, char **endh, return 0; } -int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh) +int class_parse_nid4(char *buf, lnet_nid_t *nid4, char **endh) { - return class_parse_value(buf, CLASS_PARSE_NID, (void *)nid, endh, 0); + return class_parse_value(buf, CLASS_PARSE_NID4, (void *)nid4, endh, 0); } -EXPORT_SYMBOL(class_parse_nid); +EXPORT_SYMBOL(class_parse_nid4); -int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh) +int class_parse_nid4_quiet(char *buf, lnet_nid_t *nid4, char **endh) { - return class_parse_value(buf, CLASS_PARSE_NID, (void *)nid, endh, 1); + return class_parse_value(buf, CLASS_PARSE_NID4, (void *)nid4, endh, 1); } -EXPORT_SYMBOL(class_parse_nid_quiet); +EXPORT_SYMBOL(class_parse_nid4_quiet); int class_parse_net(char *buf, __u32 *net, char **endh) { @@ -512,7 +512,7 @@ int class_match_nid(char *buf, char *key, lnet_nid_t nid) * please restrict to the NIDs pertaining to * the specified NIDs */ - while (class_parse_nid(buf, &tmp, &buf) == 0) { + while (class_parse_nid4(buf, &tmp, &buf) == 0) { if (tmp == nid) return 1; } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index d2f4fe5..95f06e7 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -237,7 +237,7 @@ int lustre_start_mgc(struct super_block *sb) /* mount -o mgsnode=nid */ ptr = lsi->lsi_lmd->lmd_mgs; if (lsi->lsi_lmd->lmd_mgs && - (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) { + (class_parse_nid4(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) { i++; } else if (IS_MGS(lsi)) { struct lnet_processid id; @@ -253,7 +253,7 @@ int lustre_start_mgc(struct super_block *sb) } else { /* client */ /* Use NIDs from mount line: uml1,1@elan:uml2,2@elan:/lustre */ ptr = lsi->lsi_lmd->lmd_dev; - if (class_parse_nid(ptr, &nid, &ptr) == 0) + if (class_parse_nid4(ptr, &nid, &ptr) == 0) i++; } if (i == 0) { @@ -370,7 +370,7 @@ int lustre_start_mgc(struct super_block *sb) * Multiple NIDs on one MGS node are separated * by commas. */ - while (class_parse_nid(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); if (rc == 0) @@ -383,7 +383,7 @@ int lustre_start_mgc(struct super_block *sb) } else { /* client */ /* Use NIDs from mount line: uml1,1@elan:uml2,2@elan:/lustre */ ptr = lsi->lsi_lmd->lmd_dev; - while (class_parse_nid(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); if (rc == 0) @@ -421,7 +421,7 @@ int lustre_start_mgc(struct super_block *sb) /* New failover node */ sprintf(niduuid, "%s_%x", mgcname, i); j = 0; - while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { + while (class_parse_nid4_quiet(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); if (rc == 0) @@ -1155,7 +1155,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr) int oldlen = 0; /* Find end of NID-list */ - while (class_parse_nid_quiet(tail, &nid, &tail) == 0) + while (class_parse_nid4_quiet(tail, &nid, &tail) == 0) ; /* do nothing */ length = tail - *ptr; -- 1.8.3.1