From 66b4fd4317f9bd721aaa485c81987cecc049d92f Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Tue, 31 Mar 2020 20:31:24 -0400 Subject: [PATCH] LU-8454 Remove struct mgs_send_param and its users This code has been somewhat dormant since 2.9 and now it's time to remove it. Change-Id: I392c29d30e11b4feb362ac2f396a2f687c81c52a Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/38106 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Tested-by: jenkins --- lustre/include/uapi/linux/lustre/lustre_idl.h | 9 ---- lustre/llite/dir.c | 76 --------------------------- lustre/mgc/mgc_request.c | 48 ----------------- lustre/mgs/mgs_handler.c | 63 ---------------------- lustre/ptlrpc/layout.c | 25 --------- lustre/ptlrpc/wiretest.c | 9 ---- lustre/utils/wirecheck.c | 14 ----- lustre/utils/wiretest.c | 9 ---- 8 files changed, 253 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 008132c..2f4c083 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2569,15 +2569,6 @@ enum mgs_cmd { MGS_FIRST_OPC = MGS_CONNECT }; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -#define MGS_PARAM_MAXLEN 1024 -#define KEY_SET_INFO "set_info" - -struct mgs_send_param { - char mgs_param[MGS_PARAM_MAXLEN]; -}; -#endif - /* We pass this info to the MGS so it can write config logs */ #define MTI_NAME_MAXLEN 64 #define MTI_PARAM_MAXLEN 4096 diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index f311d1b..c70f91d 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -412,27 +412,6 @@ out: RETURN(rc); } -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -static int ll_send_mgc_param(struct obd_export *mgc, char *string) -{ - struct mgs_send_param *msp; - int rc = 0; - - OBD_ALLOC_PTR(msp); - if (!msp) - return -ENOMEM; - - strlcpy(msp->mgs_param, string, sizeof(msp->mgs_param)); - rc = obd_set_info_async(NULL, mgc, sizeof(KEY_SET_INFO), KEY_SET_INFO, - sizeof(struct mgs_send_param), msp, NULL); - if (rc) - CERROR("Failed to set parameter: %d\n", rc); - OBD_FREE_PTR(msp); - - return rc; -} -#endif - /** * Create striped directory with specified stripe(@lump) * @@ -578,10 +557,6 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, struct md_op_data *op_data; struct ptlrpc_request *req = NULL; int rc = 0; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) - struct lustre_sb_info *lsi = s2lsi(inode->i_sb); - struct obd_device *mgc = lsi->lsi_mgc; -#endif int lum_size; ENTRY; @@ -643,57 +618,6 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, if (rc) RETURN(rc); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) - /* - * 2.9 server has stored filesystem default stripe in ROOT xattr, - * and it's stored into system config for backward compatibility. - * - * In the following we use the fact that LOV_USER_MAGIC_V1 and - * LOV_USER_MAGIC_V3 have the same initial fields so we do not - * need the make the distiction between the 2 versions - */ - if (set_default && mgc->u.cli.cl_mgc_mgsexp && - (lump == NULL || - le32_to_cpu(lump->lmm_magic) == LOV_USER_MAGIC_V1 || - le32_to_cpu(lump->lmm_magic) == LOV_USER_MAGIC_V3)) { - char *param = NULL; - char *buf; - - OBD_ALLOC(param, MGS_PARAM_MAXLEN); - if (param == NULL) - GOTO(end, rc = -ENOMEM); - - buf = param; - /* Get fsname and assume devname to be -MDT0000. */ - snprintf(buf, MGS_PARAM_MAXLEN, "%s-MDT0000.lov", - sbi->ll_fsname); - buf += strlen(buf); - - /* Set root stripesize */ - snprintf(buf, MGS_PARAM_MAXLEN, ".stripesize=%u", - lump ? le32_to_cpu(lump->lmm_stripe_size) : 0); - rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); - if (rc) - GOTO(end, rc); - - /* Set root stripecount */ - snprintf(buf, MGS_PARAM_MAXLEN, ".stripecount=%hd", - lump ? le16_to_cpu(lump->lmm_stripe_count) : 0); - rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); - if (rc) - GOTO(end, rc); - - /* Set root stripeoffset */ - snprintf(buf, MGS_PARAM_MAXLEN, ".stripeoffset=%hd", - lump ? le16_to_cpu(lump->lmm_stripe_offset) : - (typeof(lump->lmm_stripe_offset))(-1)); - rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); - -end: - if (param != NULL) - OBD_FREE(param, MGS_PARAM_MAXLEN); - } -#endif RETURN(rc); } diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index f827fba..1776eff 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1080,45 +1080,6 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, #define MGC_TARGET_REG_LIMIT_MAX RECONNECT_DELAY_MAX #define MGC_SEND_PARAM_LIMIT 10 -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -/* Send parameter to MGS*/ -static int mgc_set_mgs_param(struct obd_export *exp, - struct mgs_send_param *msp) -{ - struct ptlrpc_request *req; - struct mgs_send_param *req_msp, *rep_msp; - int rc; - ENTRY; - - req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), - &RQF_MGS_SET_INFO, LUSTRE_MGS_VERSION, - MGS_SET_INFO); - if (!req) - RETURN(-ENOMEM); - - req_msp = req_capsule_client_get(&req->rq_pill, &RMF_MGS_SEND_PARAM); - if (!req_msp) { - ptlrpc_req_finished(req); - RETURN(-ENOMEM); - } - - memcpy(req_msp, msp, sizeof(*req_msp)); - ptlrpc_request_set_replen(req); - - /* Limit how long we will wait for the enqueue to complete */ - req->rq_delay_limit = MGC_SEND_PARAM_LIMIT; - rc = ptlrpc_queue_wait(req); - if (!rc) { - rep_msp = req_capsule_server_get(&req->rq_pill, &RMF_MGS_SEND_PARAM); - memcpy(msp, rep_msp, sizeof(*rep_msp)); - } - - ptlrpc_req_finished(req); - - RETURN(rc); -} -#endif - /* Take a config lock so we can get cancel notifications */ static int mgc_enqueue(struct obd_export *exp, enum ldlm_type type, union ldlm_policy_data *policy, enum ldlm_mode mode, @@ -1293,15 +1254,6 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc = mgc_fs_cleanup(env, exp->exp_obd); RETURN(rc); } -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) - if (KEY_IS(KEY_SET_INFO)) { - struct mgs_send_param *msp; - - msp = (struct mgs_send_param *)val; - rc = mgc_set_mgs_param(exp, msp); - RETURN(rc); - } -#endif if (KEY_IS(KEY_MGSSEC)) { struct client_obd *cli = &exp->exp_obd->u.cli; struct sptlrpc_flavor flvr; diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 00ec088..99ca391 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -96,66 +96,6 @@ static inline bool str_starts_with(const char *str, const char *prefix) return strncmp(str, prefix, strlen(prefix)) == 0; } -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -static int mgs_set_info(struct tgt_session_info *tsi) -{ - struct mgs_thread_info *mgi; - struct mgs_send_param *msp, *rep_msp; - struct lustre_cfg *lcfg; - size_t param_len; - char *s; - int rc; - - ENTRY; - - mgi = mgs_env_info(tsi->tsi_env); - if (IS_ERR(mgi)) - RETURN(err_serious(PTR_ERR(mgi))); - - msp = req_capsule_client_get(tsi->tsi_pill, &RMF_MGS_SEND_PARAM); - if (msp == NULL) - RETURN(err_serious(-EFAULT)); - - param_len = strnlen(msp->mgs_param, sizeof(msp->mgs_param)); - if (param_len == 0 || param_len == sizeof(msp->mgs_param)) - RETURN(-EINVAL); - - /* We only allow '*.lov.stripe{size,count,offset}=*' from an RPC. */ - s = strchr(msp->mgs_param, '.'); - if (s == NULL) - RETURN(-EINVAL); - - if (!str_starts_with(s + 1, "lov.stripesize=") && - !str_starts_with(s + 1, "lov.stripecount=") && - !str_starts_with(s + 1, "lov.stripeoffset=")) - RETURN(-EINVAL); - - /* Construct lustre_cfg structure to pass to function mgs_set_param */ - lustre_cfg_bufs_reset(&mgi->mgi_bufs, NULL); - lustre_cfg_bufs_set_string(&mgi->mgi_bufs, 1, msp->mgs_param); - OBD_ALLOC(lcfg, lustre_cfg_len(mgi->mgi_bufs.lcfg_bufcount, - mgi->mgi_bufs.lcfg_buflen)); - if (!lcfg) - RETURN(-ENOMEM); - lustre_cfg_init(lcfg, LCFG_PARAM, &mgi->mgi_bufs); - - rc = mgs_set_param(tsi->tsi_env, exp2mgs_dev(tsi->tsi_exp), lcfg); - if (rc) { - LCONSOLE_WARN("%s: Unable to set parameter %s: %d\n", - tgt_name(tsi->tsi_tgt), msp->mgs_param, rc); - GOTO(out_cfg, rc); - } - - /* send back the whole msp in the reply */ - rep_msp = req_capsule_server_get(tsi->tsi_pill, &RMF_MGS_SEND_PARAM); - *rep_msp = *msp; - EXIT; -out_cfg: - OBD_FREE(lcfg, lustre_cfg_len(lcfg->lcfg_bufcount, lcfg->lcfg_buflens)); - return rc; -} -#endif - enum ast_type { AST_CONFIG = 1, AST_PARAMS = 2, @@ -1201,9 +1141,6 @@ TGT_RPC_HANDLER(MGS_FIRST_OPC, 0, MGS_DISCONNECT, mgs_disconnect, &RQF_MDS_DISCONNECT, LUSTRE_OBD_VERSION), TGT_MGS_HDL_VAR(0, MGS_EXCEPTION, mgs_exception), -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -TGT_MGS_HDL(HAS_REPLY | IS_MUTABLE, MGS_SET_INFO, mgs_set_info), -#endif TGT_MGS_HDL(HAS_REPLY | IS_MUTABLE, MGS_TARGET_REG, mgs_target_reg), TGT_MGS_HDL_VAR(0, MGS_TARGET_DEL, mgs_target_del), TGT_MGS_HDL(HAS_REPLY, MGS_CONFIG_READ, mgs_config_read), diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index c963114..48751d1 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -71,13 +71,6 @@ static const struct req_msg_field *mgs_target_info_only[] = { &RMF_MGS_TARGET_INFO }; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -static const struct req_msg_field *mgs_set_info[] = { - &RMF_PTLRPC_BODY, - &RMF_MGS_SEND_PARAM -}; -#endif - static const struct req_msg_field *mgs_config_read_client[] = { &RMF_PTLRPC_BODY, &RMF_MGS_CONFIG_BODY @@ -757,9 +750,6 @@ static struct req_format *req_formats[] = { &RQF_OBD_IDX_READ, &RQF_SEC_CTX, &RQF_MGS_TARGET_REG, -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) - &RQF_MGS_SET_INFO, -#endif &RQF_MGS_CONFIG_READ, &RQF_SEQ_QUERY, &RQF_FLD_QUERY, @@ -916,14 +906,6 @@ struct req_msg_field RMF_MGS_TARGET_INFO = lustre_swab_mgs_target_info, NULL); EXPORT_SYMBOL(RMF_MGS_TARGET_INFO); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -struct req_msg_field RMF_MGS_SEND_PARAM = - DEFINE_MSGF("mgs_send_param", 0, - sizeof(struct mgs_send_param), - NULL, NULL); -EXPORT_SYMBOL(RMF_MGS_SEND_PARAM); -#endif - struct req_msg_field RMF_MGS_CONFIG_BODY = DEFINE_MSGF("mgs_config_read request", 0, sizeof(struct mgs_config_body), @@ -1361,13 +1343,6 @@ struct req_format RQF_MGS_TARGET_REG = mgs_target_info_only); EXPORT_SYMBOL(RQF_MGS_TARGET_REG); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -struct req_format RQF_MGS_SET_INFO = - DEFINE_REQ_FMT0("MGS_SET_INFO", mgs_set_info, - mgs_set_info); -EXPORT_SYMBOL(RQF_MGS_SET_INFO); -#endif - struct req_format RQF_MGS_CONFIG_READ = DEFINE_REQ_FMT0("MGS_CONFIG_READ", mgs_config_read_client, mgs_config_read_server); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 2e5d78b..8375e5a 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -3812,15 +3812,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct barrier_lvb *)0)->lvb_padding) == 8, "found %lld\n", (long long)(int)sizeof(((struct barrier_lvb *)0)->lvb_padding)); - /* Checks for struct mgs_send_param */ - LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", - (long long)(int)sizeof(struct mgs_send_param)); - BUILD_BUG_ON(MGS_PARAM_MAXLEN != 1024); - LASSERTF((int)offsetof(struct mgs_send_param, mgs_param[1024]) == 1024, "found %lld\n", - (long long)(int)offsetof(struct mgs_send_param, mgs_param[1024])); - LASSERTF((int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]) == 1, "found %lld\n", - (long long)(int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024])); - /* Checks for struct cfg_marker */ LASSERTF((int)sizeof(struct cfg_marker) == 160, "found %lld\n", (long long)(int)sizeof(struct cfg_marker)); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index c551df9..e87dff7 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -1657,17 +1657,6 @@ static void check_ldlm_barrier_lvb(void) CHECK_MEMBER(barrier_lvb, lvb_padding); } -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) -static void -check_mgs_send_param(void) -{ - BLANK_LINE(); - CHECK_STRUCT(mgs_send_param); - CHECK_CVALUE(MGS_PARAM_MAXLEN); - CHECK_MEMBER(mgs_send_param, mgs_param[MGS_PARAM_MAXLEN]); -} -#endif - static void check_cfg_marker(void) { @@ -2970,9 +2959,6 @@ main(int argc, char **argv) check_ldlm_gl_lquota_desc(); check_ldlm_gl_barrier_desc(); check_ldlm_barrier_lvb(); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) - check_mgs_send_param(); -#endif check_cfg_marker(); check_llog_logid(); check_llog_catid(); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 8aaf4f5..c150111 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -3844,15 +3844,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct barrier_lvb *)0)->lvb_padding) == 8, "found %lld\n", (long long)(int)sizeof(((struct barrier_lvb *)0)->lvb_padding)); - /* Checks for struct mgs_send_param */ - LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", - (long long)(int)sizeof(struct mgs_send_param)); - BUILD_BUG_ON(MGS_PARAM_MAXLEN != 1024); - LASSERTF((int)offsetof(struct mgs_send_param, mgs_param[1024]) == 1024, "found %lld\n", - (long long)(int)offsetof(struct mgs_send_param, mgs_param[1024])); - LASSERTF((int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]) == 1, "found %lld\n", - (long long)(int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024])); - /* Checks for struct cfg_marker */ LASSERTF((int)sizeof(struct cfg_marker) == 160, "found %lld\n", (long long)(int)sizeof(struct cfg_marker)); -- 1.8.3.1