[lustre-devel] [PATCH 584/622] lustre: uapi: LU-12521 llapi: add separate fsname and instance API

James Simmons jsimmons at infradead.org
Thu Feb 27 13:17:32 PST 2020


From: Andreas Dilger <adilger at whamcloud.com>

For Lustre the kernel internal cfg instance is represented by a
16 numeric value very similar but not an UUID. This value is
exposed to user land since this value is used to generate the
sysfs directory tree to represent virtual devices. Expose this
fixed value for kernel and user land use.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12521
Lustre-commit: 00d14521ca1c ("LU-12521 llapi: add separate fsname and instance API")
Signed-off-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/35451
Reviewed-by: Olaf Faaland-LLNL <faaland1 at llnl.gov>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/obdclass/obd_config.c         | 2 +-
 include/uapi/linux/lustre/lustre_user.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/lustre/obdclass/obd_config.c b/fs/lustre/obdclass/obd_config.c
index 97cb8c1..0ccdf5f 100644
--- a/fs/lustre/obdclass/obd_config.c
+++ b/fs/lustre/obdclass/obd_config.c
@@ -1374,7 +1374,7 @@ int class_config_llog_handler(const struct lu_env *env,
 		    lcfg->lcfg_command != LCFG_SPTLRPC_CONF &&
 		    LUSTRE_CFG_BUFLEN(lcfg, 0) > 0) {
 			inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) +
-				   sizeof(clli->cfg_instance) * 2 + 4;
+				   LUSTRE_MAXINSTANCE + 4;
 			inst_name = kasprintf(GFP_NOFS, "%s-%px",
 					      lustre_cfg_string(lcfg, 0),
 					      clli->cfg_instance);
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 1c36114..08589e6 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -829,6 +829,7 @@ static inline char *obd_uuid2str(const struct obd_uuid *uuid)
 }
 
 #define LUSTRE_MAXFSNAME 8
+#define LUSTRE_MAXINSTANCE 16
 
 /* Extract fsname from uuid (or target name) of a target
  * e.g. (myfs-OST0007_UUID -> myfs)
-- 
1.8.3.1



More information about the lustre-devel mailing list