From 20ffe2191c828d3e4922429f2a98584d4e41eb53 Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Tue, 29 Aug 2017 15:13:13 +0200 Subject: [PATCH] LU-8400 mdd: remove OBD_IOC_GET_MNTOPT This ioctl was only used between MDT and MDD. Replace it, as well as mdo_maxeasize_get by a generic mdo_dtconf_get function. Change-Id: Idb080007a0b7311d6fc95f06cf24db8e9c3265d6 Signed-off-by: Henri Doreau Reviewed-on: https://review.whamcloud.com/28777 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/include/md_object.h | 4 +- lustre/include/uapi/linux/lustre/lustre_ioctl.h | 4 +- lustre/mdd/mdd_device.c | 16 +-- lustre/mdt/mdt_handler.c | 162 ++++++++++++------------ 4 files changed, 88 insertions(+), 98 deletions(-) diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index d64d243..3cd7bee 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -286,8 +286,8 @@ struct md_device_operations { int (*mdo_root_get)(const struct lu_env *env, struct md_device *m, struct lu_fid *f); - int (*mdo_maxeasize_get)(const struct lu_env *env, struct md_device *m, - int *easize); + const struct dt_device_param *(*mdo_dtconf_get)(const struct lu_env *e, + struct md_device *m); int (*mdo_statfs)(const struct lu_env *env, struct md_device *m, struct obd_statfs *sfs); diff --git a/lustre/include/uapi/linux/lustre/lustre_ioctl.h b/lustre/include/uapi/linux/lustre/lustre_ioctl.h index 5469e29..9a28842 100644 --- a/lustre/include/uapi/linux/lustre/lustre_ioctl.h +++ b/lustre/include/uapi/linux/lustre/lustre_ioctl.h @@ -233,8 +233,8 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data) #define OBD_IOC_LCFG_ERASE _IOWR('f', 209, OBD_IOC_DATA_TYPE) #define OBD_IOC_GET_OBJ_VERSION _IOR('f', 210, OBD_IOC_DATA_TYPE) -/* lustre/lustre_user.h 212-217 */ -#define OBD_IOC_GET_MNTOPT _IOW('f', 220, mntopt_t) +/* lustre/lustre_user.h 211-220 */ +/* was #define OBD_IOC_GET_MNTOPT _IOW('f', 220, mntopt_t) until 2.11 */ #define OBD_IOC_ECHO_MD _IOR('f', 221, struct obd_ioctl_data) #define OBD_IOC_ECHO_ALLOC_SEQ _IOWR('f', 222, struct obd_ioctl_data) #define OBD_IOC_START_LFSCK _IOWR('f', 230, OBD_IOC_DATA_TYPE) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index d43bf3b..543f3e0 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -1150,15 +1150,12 @@ static int mdd_statfs(const struct lu_env *env, struct md_device *m, RETURN(rc); } -static int mdd_maxeasize_get(const struct lu_env *env, struct md_device *m, - int *easize) +static const struct dt_device_param *mdd_dtconf_get(const struct lu_env *env, + struct md_device *m) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); - ENTRY; - - *easize = mdd->mdd_dt_conf.ddp_max_ea_size; - RETURN(0); + return &mdd->mdd_dt_conf; } static int mdd_llog_ctxt_get(const struct lu_env *env, struct md_device *m, @@ -1629,11 +1626,6 @@ static int mdd_iocontrol(const struct lu_env *env, struct md_device *m, barrier_exit(mdd->mdd_bottom); RETURN(rc); } - case OBD_IOC_GET_MNTOPT: { - mntopt_t *mntopts = (mntopt_t *)karg; - *mntopts = mdd->mdd_dt_conf.ddp_mntopts; - RETURN(0); - } case OBD_IOC_START_LFSCK: { rc = lfsck_start(env, mdd->mdd_bottom, (struct lfsck_start_param *)karg); @@ -1692,7 +1684,7 @@ static const struct md_device_operations mdd_ops = { .mdo_root_get = mdd_root_get, .mdo_llog_ctxt_get = mdd_llog_ctxt_get, .mdo_iocontrol = mdd_iocontrol, - .mdo_maxeasize_get = mdd_maxeasize_get, + .mdo_dtconf_get = mdd_dtconf_get, }; static struct lu_device_type_operations mdd_device_type_ops = { diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index dfaa281..9f8590b 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4816,55 +4816,56 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m) static int mdt_postrecov(const struct lu_env *, struct mdt_device *); static int mdt_init0(const struct lu_env *env, struct mdt_device *m, - struct lu_device_type *ldt, struct lustre_cfg *cfg) -{ - struct mdt_thread_info *info; - struct obd_device *obd; - const char *dev = lustre_cfg_string(cfg, 0); - const char *num = lustre_cfg_string(cfg, 2); - struct lustre_mount_info *lmi = NULL; - struct lustre_sb_info *lsi; - struct lu_site *s; - struct seq_server_site *ss_site; - const char *identity_upcall = "NONE"; - struct md_device *next; - int rc; - long node_id; - mntopt_t mntopts; - ENTRY; + struct lu_device_type *ldt, struct lustre_cfg *cfg) +{ + const struct dt_device_param *dt_conf; + struct mdt_thread_info *info; + struct obd_device *obd; + const char *dev = lustre_cfg_string(cfg, 0); + const char *num = lustre_cfg_string(cfg, 2); + struct lustre_mount_info *lmi = NULL; + struct lustre_sb_info *lsi; + struct lu_site *s; + struct seq_server_site *ss_site; + const char *identity_upcall = "NONE"; + struct md_device *next; + int rc; + long node_id; + mntopt_t mntopts; + ENTRY; lu_device_init(&m->mdt_lu_dev, ldt); - /* - * Environment (env) might be missing mdt_thread_key values at that - * point, if device is allocated when mdt_thread_key is in QUIESCENT - * mode. - * - * Usually device allocation path doesn't use module key values, but - * mdt has to do a lot of work here, so allocate key value. - */ - rc = lu_env_refill((struct lu_env *)env); - if (rc != 0) - RETURN(rc); + /* + * Environment (env) might be missing mdt_thread_key values at that + * point, if device is allocated when mdt_thread_key is in QUIESCENT + * mode. + * + * Usually device allocation path doesn't use module key values, but + * mdt has to do a lot of work here, so allocate key value. + */ + rc = lu_env_refill((struct lu_env *)env); + if (rc != 0) + RETURN(rc); - info = lu_context_key_get(&env->le_ctx, &mdt_thread_key); - LASSERT(info != NULL); + info = lu_context_key_get(&env->le_ctx, &mdt_thread_key); + LASSERT(info != NULL); - obd = class_name2obd(dev); - LASSERT(obd != NULL); + obd = class_name2obd(dev); + LASSERT(obd != NULL); - m->mdt_max_mdsize = MAX_MD_SIZE; /* 4 stripes */ + m->mdt_max_mdsize = MAX_MD_SIZE; /* 4 stripes */ m->mdt_opts.mo_evict_tgt_nids = 1; - m->mdt_opts.mo_cos = MDT_COS_DEFAULT; + m->mdt_opts.mo_cos = MDT_COS_DEFAULT; lmi = server_get_mount(dev); - if (lmi == NULL) { - CERROR("Cannot get mount info for %s!\n", dev); - RETURN(-EFAULT); - } else { - lsi = s2lsi(lmi->lmi_sb); - /* CMD is supported only in IAM mode */ - LASSERT(num); - node_id = simple_strtol(num, NULL, 10); + if (lmi == NULL) { + CERROR("Cannot get mount info for %s!\n", dev); + RETURN(-EFAULT); + } else { + lsi = s2lsi(lmi->lmi_sb); + /* CMD is supported only in IAM mode */ + LASSERT(num); + node_id = simple_strtol(num, NULL, 10); obd->u.obt.obt_magic = OBT_MAGIC; if (lsi->lsi_lmd != NULL && lsi->lsi_lmd->lmd_flags & LMD_FLG_SKIP_LFSCK) @@ -4901,16 +4902,16 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, s->ld_seq_site = ss_site; ss_site->ss_lu = s; - /* set server index */ + /* set server index */ ss_site->ss_node_id = node_id; /* failover is the default * FIXME: we do not failout mds0/mgs, which may cause some problems. * assumed whose ss_node_id == 0 XXX * */ - obd->obd_replayable = 1; - /* No connection accepted until configurations will finish */ - obd->obd_no_conn = 1; + obd->obd_replayable = 1; + /* No connection accepted until configurations will finish */ + obd->obd_no_conn = 1; if (cfg->lcfg_bufcount > 4 && LUSTRE_CFG_BUFLEN(cfg, 4) > 0) { char *str = lustre_cfg_string(cfg, 4); @@ -4930,25 +4931,25 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, snprintf(info->mti_u.ns_name, sizeof(info->mti_u.ns_name), "%s-%s", LUSTRE_MDT_NAME, obd->obd_uuid.uuid); - m->mdt_namespace = ldlm_namespace_new(obd, info->mti_u.ns_name, - LDLM_NAMESPACE_SERVER, - LDLM_NAMESPACE_GREEDY, - LDLM_NS_TYPE_MDT); - if (m->mdt_namespace == NULL) - GOTO(err_fini_seq, rc = -ENOMEM); + m->mdt_namespace = ldlm_namespace_new(obd, info->mti_u.ns_name, + LDLM_NAMESPACE_SERVER, + LDLM_NAMESPACE_GREEDY, + LDLM_NS_TYPE_MDT); + if (m->mdt_namespace == NULL) + GOTO(err_fini_seq, rc = -ENOMEM); m->mdt_namespace->ns_lvbp = m; m->mdt_namespace->ns_lvbo = &mdt_lvbo; - ldlm_register_intent(m->mdt_namespace, mdt_intent_policy); - /* set obd_namespace for compatibility with old code */ - obd->obd_namespace = m->mdt_namespace; + ldlm_register_intent(m->mdt_namespace, mdt_intent_policy); + /* set obd_namespace for compatibility with old code */ + obd->obd_namespace = m->mdt_namespace; rc = mdt_hsm_cdt_init(m); if (rc != 0) { CERROR("%s: error initializing coordinator, rc %d\n", mdt_obd_name(m), rc); - GOTO(err_free_ns, rc); + GOTO(err_free_ns, rc); } rc = tgt_init(env, &m->mdt_lut, obd, m->mdt_bottom, mdt_common_slice, @@ -4963,25 +4964,22 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, tgt_adapt_sptlrpc_conf(&m->mdt_lut); - next = m->mdt_child; - rc = next->md_ops->mdo_iocontrol(env, next, OBD_IOC_GET_MNTOPT, 0, - &mntopts); - if (rc) - GOTO(err_fs_cleanup, rc); + next = m->mdt_child; + dt_conf = next->md_ops->mdo_dtconf_get(env, next); - if (mntopts & MNTOPT_USERXATTR) - m->mdt_opts.mo_user_xattr = 1; - else - m->mdt_opts.mo_user_xattr = 0; + mntopts = dt_conf->ddp_mntopts; - rc = next->md_ops->mdo_maxeasize_get(env, next, &m->mdt_max_ea_size); - if (rc) - GOTO(err_fs_cleanup, rc); + if (mntopts & MNTOPT_USERXATTR) + m->mdt_opts.mo_user_xattr = 1; + else + m->mdt_opts.mo_user_xattr = 0; - if (mntopts & MNTOPT_ACL) - m->mdt_opts.mo_acl = 1; - else - m->mdt_opts.mo_acl = 0; + m->mdt_max_ea_size = dt_conf->ddp_max_ea_size; + + if (mntopts & MNTOPT_ACL) + m->mdt_opts.mo_acl = 1; + else + m->mdt_opts.mo_acl = 0; /* XXX: to support suppgid for ACL, we enable identity_upcall * by default, otherwise, maybe got unexpected -EACCESS. */ @@ -4997,11 +4995,11 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, GOTO(err_fs_cleanup, rc); } - rc = mdt_procfs_init(m, dev); - if (rc) { - CERROR("Can't init MDT lprocfs, rc %d\n", rc); - GOTO(err_recovery, rc); - } + rc = mdt_procfs_init(m, dev); + if (rc) { + CERROR("Can't init MDT lprocfs, rc %d\n", rc); + GOTO(err_recovery, rc); + } rc = mdt_quota_init(env, m, cfg); if (rc) @@ -5017,13 +5015,13 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, * when the whole stack is complete and ready * to serve the requests */ - /* Reduce the initial timeout on an MDS because it doesn't need such - * a long timeout as an OST does. Adaptive timeouts will adjust this - * value appropriately. */ - if (ldlm_timeout == LDLM_TIMEOUT_DEFAULT) - ldlm_timeout = MDS_LDLM_TIMEOUT_DEFAULT; + /* Reduce the initial timeout on an MDS because it doesn't need such + * a long timeout as an OST does. Adaptive timeouts will adjust this + * value appropriately. */ + if (ldlm_timeout == LDLM_TIMEOUT_DEFAULT) + ldlm_timeout = MDS_LDLM_TIMEOUT_DEFAULT; - RETURN(0); + RETURN(0); err_procfs: mdt_procfs_fini(m); err_recovery: -- 1.8.3.1