Whamcloud - gitweb
LU-17995 osd-zfs: remove server_name_is_ost() 63/58163/2
authorTimothy Day <timday@amazon.com>
Sat, 22 Feb 2025 17:54:10 +0000 (12:54 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 6 Mar 2025 08:07:36 +0000 (08:07 +0000)
We can determine whether a server name is for an
OST by checking the return code of server_name2index().

Test-Parameters: trivial
Test-Parameters: trivial fstype=zfs
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I2e1c337b9095d333772f87bd2a5253966b54bd45
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58163
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_disk.h
lustre/obdclass/obd_mount.c
lustre/osd-zfs/osd_handler.c

index 89fc3a4..e39b310 100644 (file)
@@ -368,7 +368,6 @@ void server_calc_timeout(struct lustre_sb_info *lsi, struct obd_device *obd);
 int server_name2svname(const char *label, char *svname, const char **endptr,
                       size_t svsize);
 
-int server_name_is_ost(const char *svname);
 int target_name2index(const char *svname, u32 *idx, const char **endptr);
 
 int lustre_put_lsi(struct super_block *sb);
index 7de849f..9ec1a92 100644 (file)
@@ -891,29 +891,6 @@ int server_name2svname(const char *label, char *svname, const char **endptr,
 EXPORT_SYMBOL(server_name2svname);
 #endif /* HAVE_SERVER_SUPPORT */
 
-#ifdef HAVE_SERVER_SUPPORT
-/**
- * check server name is OST.
- **/
-int server_name_is_ost(const char *svname)
-{
-       const char *dash;
-       int rc;
-
-       /* We use server_name2fsname() just for parsing */
-       rc = server_name2fsname(svname, NULL, &dash);
-       if (rc != 0)
-               return rc;
-
-       dash++;
-
-       if (strncmp(dash, "OST", 3) == 0)
-               return 1;
-       return 0;
-}
-EXPORT_SYMBOL(server_name_is_ost);
-#endif /* HAVE_SERVER_SUPPORT */
-
 /**
  * Get the index from the target name MDTXXXX/OSTXXXX
  * rc = server type, or rc < 0  on error
index 9cf26ee..af860af 100644 (file)
@@ -1102,8 +1102,12 @@ static int osd_mount(const struct lu_env *env,
        opts = lustre_cfg_string(cfg, 3);
 
        o->od_index_backup_stop = 0;
+
        o->od_index = -1; /* -1 means index is invalid */
        rc = server_name2index(o->od_svname, &o->od_index, NULL);
+       if (rc == LDD_F_SV_TYPE_OST)
+               o->od_is_ost = 1;
+
        str = strstr(str, ":");
        if (str) {
                unsigned long flags;
@@ -1122,9 +1126,6 @@ static int osd_mount(const struct lu_env *env,
                        interval = AS_NEVER;
        }
 
-       if (server_name_is_ost(o->od_svname))
-               o->od_is_ost = 1;
-
        rc = osd_objset_open(o);
        if (rc)
                RETURN(rc);