[lustre-devel] [PATCH 13/25] lustre: obdclass: convert class_parse_nid4 to class_parse_nid
James Simmons
jsimmons at infradead.org
Thu Jan 30 06:11:03 PST 2025
From: Mr NeilBrown <neilb at suse.de>
All callers of class_parse_nid4() now use class_parse_nid()
and so much handle a large nid.
do_lcfg_nid() is introduced to help with this.
WC-bug-id: https://jira.whamcloud.com/browse/LU-13340
Lustre-commit: 6c3b50434b321cc16 ("LU-13340 mgs: convert class_parse_nid4 to class_parse_nid")
Signed-off-by: Mr NeilBrown <neilb at suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50094
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Alex Zhuravlev <bzzz at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/obdclass/obd_mount.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/fs/lustre/obdclass/obd_mount.c b/fs/lustre/obdclass/obd_mount.c
index 6eaa214c813f..c569592bd6e7 100644
--- a/fs/lustre/obdclass/obd_mount.c
+++ b/fs/lustre/obdclass/obd_mount.c
@@ -179,6 +179,15 @@ static int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
return rc;
}
+static int do_lcfg_nid(char *cfgname, struct lnet_nid *nid, int cmd,
+ char *s1)
+{
+ if (nid_is_nid4(nid))
+ return do_lcfg(cfgname, lnet_nid_to_nid4(nid), cmd, s1,
+ NULL, NULL, NULL);
+ return -EINVAL;
+}
+
/** Call class_attach and class_setup. These methods in turn call
* obd type-specific methods.
*/
@@ -218,7 +227,7 @@ int lustre_start_mgc(struct super_block *sb)
struct obd_export *exp;
struct obd_uuid *uuid = NULL;
uuid_t uuidc;
- lnet_nid_t nid;
+ struct lnet_nid nid;
char nidstr[LNET_NIDSTR_SIZE];
char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
char *ptr;
@@ -228,7 +237,7 @@ int lustre_start_mgc(struct super_block *sb)
/* Use nids from mount line: uml1,1 at elan:uml2,2 at elan:/lustre */
ptr = lsi->lsi_lmd->lmd_dev;
- if (class_parse_nid4(ptr, &nid, &ptr) == 0)
+ if (class_parse_nid(ptr, &nid, &ptr) == 0)
i++;
if (i == 0) {
CERROR("No valid MGS nids found.\n");
@@ -237,7 +246,7 @@ int lustre_start_mgc(struct super_block *sb)
mutex_lock(&mgc_start_lock);
- libcfs_nid2str_r(nid, nidstr, sizeof(nidstr));
+ libcfs_nidstr_r(&nid, nidstr, sizeof(nidstr));
mgcname = kasprintf(GFP_NOFS,
"%s%s", LUSTRE_MGC_OBDNAME, nidstr);
niduuid = kasprintf(GFP_NOFS, "%s_%x", mgcname, 0);
@@ -314,10 +323,9 @@ int lustre_start_mgc(struct super_block *sb)
i = 0;
/* Use nids from mount line: uml1,1 at elan:uml2,2 at elan:/lustre */
ptr = lsi->lsi_lmd->lmd_dev;
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
- rc = do_lcfg(mgcname, nid,
- LCFG_ADD_UUID, niduuid, NULL, NULL, NULL);
- if (!rc)
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+ rc = do_lcfg_nid(mgcname, &nid, LCFG_ADD_UUID, niduuid);
+ if (rc == 0)
i++;
/* Stop at the first failover nid */
if (*ptr == ':')
@@ -354,10 +362,10 @@ int lustre_start_mgc(struct super_block *sb)
/* New failover node */
sprintf(niduuid, "%s_%x", mgcname, i);
j = 0;
- while (class_parse_nid4_quiet(ptr, &nid, &ptr) == 0) {
- rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid,
- NULL, NULL, NULL);
- if (!rc)
+ while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
+ rc = do_lcfg_nid(mgcname, &nid, LCFG_ADD_UUID,
+ niduuid);
+ if (rc == 0)
++j;
if (*ptr == ':')
break;
@@ -863,14 +871,14 @@ static int lmd_parse_string(char **handle, char *ptr)
/* Collect multiple values for mgsnid specifiers */
static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
{
- lnet_nid_t nid;
+ struct lnet_nid nid;
char *tail = *ptr;
char *mgsnid;
int length;
int oldlen = 0;
/* Find end of nidlist */
- while (class_parse_nid4_quiet(tail, &nid, &tail) == 0)
+ while (class_parse_nid_quiet(tail, &nid, &tail) == 0)
;
length = tail - *ptr;
if (length == 0) {
--
2.39.3
More information about the lustre-devel
mailing list