From: Timothy Day Date: Sat, 22 Feb 2025 17:54:10 +0000 (-0500) Subject: LU-17995 osd-zfs: remove server_name_is_ost() X-Git-Tag: 2.16.53~65 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4a7b1f6ad3e3f4c0dec35210b50240826fc4e8a2;p=fs%2Flustre-release.git LU-17995 osd-zfs: remove server_name_is_ost() 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 Change-Id: I2e1c337b9095d333772f87bd2a5253966b54bd45 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58163 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 89fc3a4..e39b310 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -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); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 7de849f..9ec1a92 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -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 diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index 9cf26ee..af860af 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -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);