From c40370698e32aafba5c0323f957bd700e3353cd9 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Sun, 23 Feb 2025 13:26:59 -0500 Subject: [PATCH] LU-17995 obdclass: remove obdname2fsname() This function is not called anywhere. Test-Parameters: trivial Test-Parameters: trivial fstype=zfs Signed-off-by: Timothy Day Change-Id: Ib6c92787685564e812634c8a466b9edc27ba6977 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58174 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Max Wang Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/lustre_disk.h | 1 - lustre/obdclass/obd_mount.c | 79 -------------------------------------------- 2 files changed, 80 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index e39b310..28915c5 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -376,7 +376,6 @@ int lustre_start_simple(char *obdname, char *type, char *uuid, int lustre_stop_mgc(struct super_block *sb); #endif /* HAVE_SERVER_SUPPORT */ int server_name2fsname(const char *svname, char *fsname, const char **endptr); -void obdname2fsname(const char *tgt, char *fsname, size_t fslen); int lustre_start_mgc(struct super_block *sb); int lustre_common_put_super(struct super_block *sb); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 9ec1a92..124f552 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -743,85 +743,6 @@ int lustre_put_lsi(struct super_block *sb) } EXPORT_SYMBOL(lustre_put_lsi); -/* - * The goal of this function is to extract the file system name - * from the OBD name. This can come in two flavors. One is - * fsname-MDTXXXX or fsname-XXXXXXX were X is a hexadecimal - * number. In both cases we should return fsname. If it is - * not a valid OBD name it is assumed to be the file system - * name itself. - */ -void obdname2fsname(const char *tgt, char *fsname, size_t buflen) -{ - const char *ptr; - const char *tmp; - size_t len = 0; - - /* - * First we have to see if the @tgt has '-' at all. It is - * valid for the user to request something like - * lctl set_param -P llite.lustre*.xattr_cache=0 - */ - ptr = strrchr(tgt, '-'); - if (!ptr) { - /* No '-' means it could end in '*' */ - ptr = strchr(tgt, '*'); - if (!ptr) { - /* No '*' either. Assume tgt = fsname */ - len = strlen(tgt); - goto valid_obd_name; - } - len = ptr - tgt; - goto valid_obd_name; - } - - /* tgt format fsname-MDT0000-* */ - if ((!strncmp(ptr, "-MDT", 4) || - !strncmp(ptr, "-OST", 4)) && - (isxdigit(ptr[4]) && isxdigit(ptr[5]) && - isxdigit(ptr[6]) && isxdigit(ptr[7]))) { - len = ptr - tgt; - goto valid_obd_name; - } - - /* - * tgt_format fsname-cli'dev'-'uuid' except for the llite case - * which are named fsname-'uuid'. Examples: - * - * lustre-clilov-ffff88104db5b800 - * lustre-ffff88104db5b800 (for llite device) - * - * The length of the OBD uuid can vary on different platforms. - * This test if any invalid characters are in string. Allow - * wildcards with '*' character. - */ - ptr++; - if (!strspn(ptr, "0123456789abcdefABCDEF*")) { - len = 0; - goto no_fsname; - } - - /* - * Now that we validated the device name lets extract the - * file system name. Most of the names in this class will - * have '-cli' in its name which needs to be dropped. If - * it doesn't have '-cli' then its a llite device which - * ptr already points to the start of the uuid string. - */ - tmp = strstr(tgt, "-cli"); - if (tmp) - ptr = tmp; - else - ptr--; - len = ptr - tgt; -valid_obd_name: - len = min_t(size_t, len, LUSTRE_MAXFSNAME); - snprintf(fsname, buflen, "%.*s", (int)len, tgt); -no_fsname: - fsname[len] = '\0'; -} -EXPORT_SYMBOL(obdname2fsname); - /** * SERVER NAME *** * -- 1.8.3.1