From 9a23a5de12164f9d50db9e602f085bb0c3cc9d8a Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 13 May 2021 04:42:20 -0600 Subject: [PATCH] LU-14430 mdd: rename mti_oa to mdi_oa and friends Rename fields in mdd_thread_info to confusion with mdt_thread_info. The second patch of several to rename all mdd_thread_info fields to use a more unique field prefix: mti_dof->mdi_dof mti_dt_rec->mdi_dt_rec mti_ent->mdi_ent mti_flags->mdi_flags mti_hint->mdi_hint mti_key->mdi_key mti_link_data->mdi_link_data mti_name->mdi_name mti_oa->mdi_oa mti_range->mdi_range mti_spec->mdi_spec The mti_lmv and mti_lrl fields are removed since they are unused. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I6fd4b7f26b7e9561d8a8585eaa5438d6093ebbe5 Reviewed-on: https://review.whamcloud.com/43739 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Neil Brown Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- contrib/scripts/spelling.txt | 11 ++++++++ lustre/mdd/mdd_dir.c | 67 +++++++++++++++++++++----------------------- lustre/mdd/mdd_internal.h | 33 ++++++++++------------ lustre/mdd/mdd_object.c | 6 ++-- lustre/mdd/mdd_orphans.c | 22 +++++++-------- 5 files changed, 72 insertions(+), 67 deletions(-) diff --git a/contrib/scripts/spelling.txt b/contrib/scripts/spelling.txt index ad5ef5f..761e5e7 100644 --- a/contrib/scripts/spelling.txt +++ b/contrib/scripts/spelling.txt @@ -158,7 +158,18 @@ l_wait_condition||wait_event_idle mdo2fid||mdd_object_fid mktemp||mkstemp mti_chlg_buf||mdi_chlg_buf +mti_dof||mdi_dof +mti_dt_rec||mdi_dt_rec +mti_ent||mdi_ent +mti_flags||mdi_flags +mti_hint||mdi_hint mti_link_buf||mdi_link_buf +mti_link_data||mdi_link_data +mti_key||mdi_key +mti_name||mdi_name +mti_oa||mdi_oa +mti_range||mdi_range +mti_spec||mdi_spec mti_xattr_buf||mdi_xattr_buf OS_STATE_DEGRADED||OS_STATFS_DEGRADED OS_STATE_READONLY||OS_STATFS_READONLY diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 9500da5..026d626 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -666,15 +666,14 @@ static int __mdd_index_delete_only(const struct lu_env *env, struct mdd_object * static int __mdd_index_insert_only(const struct lu_env *env, struct mdd_object *pobj, const struct lu_fid *lf, __u32 type, - const char *name, - struct thandle *handle) + const char *name, struct thandle *handle) { struct dt_object *next = mdd_object_child(pobj); - int rc; + int rc; ENTRY; if (dt_try_as_dir(env, next)) { - struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec; + struct dt_insert_rec *rec = &mdd_env_info(env)->mdi_dt_rec; rec->rec_fid = lf; rec->rec_type = type; @@ -1194,7 +1193,7 @@ int mdd_links_rename(const struct lu_env *env, ENTRY; if (ldata == NULL) { - ldata = &mdd_env_info(env)->mti_link_data; + ldata = &mdd_env_info(env)->mdi_link_data; memset(ldata, 0, sizeof(*ldata)); rc = mdd_linkea_prepare(env, mdd_obj, oldpfid, oldlname, newpfid, newlname, first, check, ldata); @@ -1391,7 +1390,7 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj, struct mdd_device *mdd = mdo2mdd(src_obj); struct thandle *handle; struct lu_fid *tfid = &mdd_env_info(env)->mti_fid2; - struct linkea_data *ldata = &mdd_env_info(env)->mti_link_data; + struct linkea_data *ldata = &mdd_env_info(env)->mdi_link_data; int rc; ENTRY; @@ -1602,7 +1601,7 @@ static int mdd_declare_unlink(const struct lu_env *env, struct mdd_device *mdd, struct thandle *handle, int no_name, int is_dir) { struct lu_attr *la = &mdd_env_info(env)->mti_la_for_fix; - int rc; + int rc; if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DANGLING2)) { if (likely(no_name == 0)) { @@ -1866,20 +1865,18 @@ static int mdd_cd_sanity_check(const struct lu_env *env, RETURN(0); } -static int mdd_create_data(const struct lu_env *env, - struct md_object *pobj, +static int mdd_create_data(const struct lu_env *env, struct md_object *pobj, struct md_object *cobj, - const struct md_op_spec *spec, - struct md_attr *ma) + const struct md_op_spec *spec, struct md_attr *ma) { struct mdd_device *mdd = mdo2mdd(cobj); struct mdd_object *mdd_pobj = md2mdd_obj(pobj); struct mdd_object *son = md2mdd_obj(cobj); - struct thandle *handle; + struct thandle *handle; const struct lu_buf *buf; - struct lu_attr *attr = MDD_ENV_VAR(env, cattr); - struct dt_allocation_hint *hint = &mdd_env_info(env)->mti_hint; - int rc; + struct lu_attr *attr = MDD_ENV_VAR(env, cattr); + struct dt_allocation_hint *hint = &mdd_env_info(env)->mdi_hint; + int rc; ENTRY; rc = mdd_cd_sanity_check(env, son); @@ -2596,9 +2593,9 @@ int mdd_create(const struct lu_env *env, struct md_object *pobj, struct lu_buf acl_buf; struct lu_buf def_acl_buf; struct lu_buf hsm_buf; - struct linkea_data *ldata = &info->mti_link_data; + struct linkea_data *ldata = &info->mdi_link_data; const char *name = lname->ln_name; - struct dt_allocation_hint *hint = &mdd_env_info(env)->mti_hint; + struct dt_allocation_hint *hint = &mdd_env_info(env)->mdi_hint; int acl_size = LUSTRE_POSIX_ACL_MAX_SIZE_OLD; int rc, rc2; @@ -2998,7 +2995,7 @@ static int mdd_rename(const struct lu_env *env, struct lu_attr *tattr = MDD_ENV_VAR(env, tattr); struct lu_attr *tpattr = MDD_ENV_VAR(env, tpattr); struct thandle *handle; - struct linkea_data *ldata = &mdd_env_info(env)->mti_link_data; + struct linkea_data *ldata = &mdd_env_info(env)->mdi_link_data; const struct lu_fid *tpobj_fid = mdd_object_fid(mdd_tpobj); const struct lu_fid *spobj_fid = mdd_object_fid(mdd_spobj); bool is_dir; @@ -3027,7 +3024,7 @@ static int mdd_rename(const struct lu_env *env, */ if (mdd_object_remote(mdd_sobj) && S_ISLNK(cattr->la_mode) && cattr->la_nlink == 1 && !tobj) { - struct md_op_spec *spec = &mdd_env_info(env)->mti_spec; + struct md_op_spec *spec = &mdd_env_info(env)->mdi_spec; struct lu_device *ld = &mdd->mdd_md_dev.md_lu_dev; struct lu_fid tfid; @@ -3570,7 +3567,7 @@ static inline int mdd_fld_lookup(const struct lu_env *env, const struct lu_fid *fid, __u32 *mdt_index) { - struct lu_seq_range *range = &mdd_env_info(env)->mti_range; + struct lu_seq_range *range = &mdd_env_info(env)->mdi_range; struct seq_server_site *ss; int rc; @@ -3626,7 +3623,7 @@ static int mdd_iterate_linkea(const struct lu_env *env, mdd_linkea_cb cb) { struct mdd_thread_info *info = mdd_env_info(env); - char *filename = info->mti_name; + char *filename = info->mdi_name; struct lu_name lname; struct lu_fid fid; int rc = 0; @@ -3640,7 +3637,7 @@ static int mdd_iterate_linkea(const struct lu_env *env, &fid); /* Note: lname might miss \0 at the end */ - snprintf(filename, sizeof(info->mti_name), "%.*s", + snprintf(filename, sizeof(info->mdi_name), "%.*s", lname.ln_namelen, lname.ln_name); lname.ln_name = filename; @@ -3786,7 +3783,7 @@ static int mdd_declare_migrate_create(const struct lu_env *env, struct thandle *handle) { struct mdd_thread_info *info = mdd_env_info(env); - struct md_layout_change *mlc = &info->mti_mlc; + struct md_layout_change *mlc = &info->mdi_mlc; struct lmv_mds_md_v1 *lmv = sbuf->lb_buf; int rc; @@ -3827,9 +3824,9 @@ static int mdd_declare_migrate_create(const struct lu_env *env, if (S_ISDIR(attr->la_mode)) { if (!lmv) { /* if sobj is not striped, fake a 1-stripe LMV */ - LASSERT(sizeof(info->mti_key) > + LASSERT(sizeof(info->mdi_key) > lmv_mds_md_size(1, LMV_MAGIC_V1)); - lmv = (typeof(lmv))info->mti_key; + lmv = (typeof(lmv))info->mdi_key; memset(lmv, 0, sizeof(*lmv)); lmv->lmv_magic = cpu_to_le32(LMV_MAGIC_V1); lmv->lmv_stripe_count = cpu_to_le32(1); @@ -4013,7 +4010,7 @@ static int mdd_migrate_create(const struct lu_env *env, */ if (S_ISDIR(attr->la_mode)) { struct mdd_thread_info *info = mdd_env_info(env); - struct md_layout_change *mlc = &info->mti_mlc; + struct md_layout_change *mlc = &info->mdi_mlc; mlc->mlc_opc = MD_LAYOUT_DETACH; @@ -4165,8 +4162,8 @@ static int mdd_migrate_object(const struct lu_env *env, struct lu_attr *spattr = &info->mti_pattr; struct lu_attr *tpattr = &info->mti_tpattr; struct lu_attr *attr = &info->mti_cattr; - struct linkea_data *ldata = &info->mti_link_data; - struct dt_allocation_hint *hint = &info->mti_hint; + struct linkea_data *ldata = &info->mdi_link_data; + struct dt_allocation_hint *hint = &info->mdi_hint; struct lu_buf sbuf = { NULL }; struct lmv_mds_md_v1 *lmv; struct thandle *handle; @@ -4600,8 +4597,8 @@ int mdd_dir_layout_shrink(const struct lu_env *env, * to a plain dir, which will cause FID change and namespace update. */ if (le32_to_cpu(lmu->lum_stripe_count) == 1) { - struct linkea_data *ldata = &info->mti_link_data; - char *filename = info->mti_name; + struct linkea_data *ldata = &info->mdi_link_data; + char *filename = info->mdi_name; rc = mdd_links_read(env, obj, ldata); if (rc) @@ -4618,7 +4615,7 @@ int mdd_dir_layout_shrink(const struct lu_env *env, fid); /* Note: lname might miss \0 at the end */ - snprintf(filename, sizeof(info->mti_name), "%.*s", + snprintf(filename, sizeof(info->mdi_name), "%.*s", lname.ln_namelen, lname.ln_name); lname.ln_name = filename; @@ -4706,7 +4703,7 @@ static int mdd_dir_declare_split_plain(const struct lu_env *env, const struct lu_name *lname = mlc->mlc_name; struct lu_attr *la = &info->mti_la_for_fix; struct lmv_user_md_v1 *lum = mlc->mlc_spec->u.sp_ea.eadata; - struct linkea_data *ldata = &info->mti_link_data; + struct linkea_data *ldata = &info->mdi_link_data; struct lmv_mds_md_v1 *lmv; __u32 count; int rc; @@ -4737,7 +4734,7 @@ static int mdd_dir_declare_split_plain(const struct lu_env *env, */ tobj->mod_obj.mo_lu.lo_header->loh_attr |= S_IFDIR; - lmv = (typeof(lmv))info->mti_key; + lmv = (typeof(lmv))info->mdi_key; memset(lmv, 0, sizeof(*lmv)); lmv->lmv_magic = cpu_to_le32(LMV_MAGIC_V1); lmv->lmv_stripe_count = cpu_to_le32(1); @@ -4805,7 +4802,7 @@ static int mdd_dir_split_plain(const struct lu_env *env, struct lu_attr *pattr = &info->mti_pattr; struct lu_attr *la = &info->mti_la_for_fix; const struct lu_name *lname = mlc->mlc_name; - struct linkea_data *ldata = &info->mti_link_data; + struct linkea_data *ldata = &info->mdi_link_data; int rc; ENTRY; @@ -4881,7 +4878,7 @@ int mdd_dir_layout_split(const struct lu_env *env, struct md_object *o, struct mdd_object *obj = md2mdd_obj(o); struct mdd_object *pobj = md2mdd_obj(mlc->mlc_parent); struct mdd_object *tobj = md2mdd_obj(mlc->mlc_target); - struct dt_allocation_hint *hint = &info->mti_hint; + struct dt_allocation_hint *hint = &info->mdi_hint; bool is_plain = false; struct thandle *handle; int rc; diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 1765a85..6b070c0 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -193,28 +193,25 @@ struct mdd_thread_info { struct lu_attr mti_la_for_fix; /* Only used in mdd_object_start */ struct lu_attr mti_la_for_start; - /* mti_ent and mti_key must be conjoint, - * then mti_ent::lde_name will be mti_key. */ - struct lu_dirent mti_ent; - char mti_key[NAME_MAX + 16]; - int mti_flags; - char mti_name[NAME_MAX + 1]; - struct lu_buf mdi_buf[4]; + /* mdi_ent/mdi_key must be together so mdi_ent::lde_name is mdi_key */ + struct lu_dirent mdi_ent; + char mdi_key[NAME_MAX + 16]; + int mdi_flags; + char mdi_name[NAME_MAX + 1]; + struct lu_buf mdi_buf[4]; /* persistent buffers, must be handled with lu_buf_alloc/free */ struct lu_buf mdi_big_buf; struct lu_buf mdi_chlg_buf; struct lu_buf mdi_link_buf; /* buf for link ea */ struct lu_buf mdi_xattr_buf; - struct obdo mti_oa; - struct dt_allocation_hint mti_hint; - struct dt_object_format mti_dof; - struct linkea_data mti_link_data; - struct md_op_spec mti_spec; - struct dt_insert_rec mti_dt_rec; - struct lfsck_req_local mti_lrl; - struct lu_seq_range mti_range; - union lmv_mds_md mti_lmv; - struct md_layout_change mti_mlc; + struct obdo mdi_oa; + struct dt_allocation_hint mdi_hint; + struct dt_object_format mdi_dof; + struct linkea_data mdi_link_data; + struct md_op_spec mdi_spec; + struct dt_insert_rec mdi_dt_rec; + struct lu_seq_range mdi_range; + struct md_layout_change mdi_mlc; }; int mdd_la_get(const struct lu_env *env, struct mdd_object *obj, @@ -742,7 +739,7 @@ int mdo_declare_index_insert(const struct lu_env *env, struct mdd_object *obj, rc = -ENOTDIR; if (dt_try_as_dir(env, next)) { - struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec; + struct dt_insert_rec *rec = &mdd_env_info(env)->mdi_dt_rec; rec->rec_fid = fid; rec->rec_type = type; diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index a971817..f466e04 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -550,7 +550,7 @@ int mdd_declare_create_object_internal(const struct lu_env *env, const struct md_op_spec *spec, struct dt_allocation_hint *hint) { - struct dt_object_format *dof = &mdd_env_info(env)->mti_dof; + struct dt_object_format *dof = &mdd_env_info(env)->mdi_dof; const struct dt_index_features *feat = spec->sp_feat; int rc; ENTRY; @@ -582,7 +582,7 @@ int mdd_create_object_internal(const struct lu_env *env, struct mdd_object *p, const struct md_op_spec *spec, struct dt_allocation_hint *hint) { - struct dt_object_format *dof = &mdd_env_info(env)->mti_dof; + struct dt_object_format *dof = &mdd_env_info(env)->mdi_dof; int rc; ENTRY; @@ -2540,7 +2540,7 @@ static int mdd_swap_layouts(const struct lu_env *env, struct md_object *obj1, if (fst_lmm != NULL) { struct ost_id temp_oi; - saved_oi = &info->mti_oa.o_oi; + saved_oi = &info->mdi_oa.o_oi; mdd_get_lmm_oi(fst_lmm, saved_oi); mdd_get_lmm_oi(snd_lmm, &temp_oi); mdd_set_lmm_gen(fst_lmm, &snd_gen); diff --git a/lustre/mdd/mdd_orphans.c b/lustre/mdd/mdd_orphans.c index 67035db..563e596 100644 --- a/lustre/mdd/mdd_orphans.c +++ b/lustre/mdd/mdd_orphans.c @@ -57,11 +57,11 @@ enum { static struct dt_key *mdd_orphan_key_fill(const struct lu_env *env, const struct lu_fid *lf) { - char *key = mdd_env_info(env)->mti_key; + char *key = mdd_env_info(env)->mdi_key; LASSERT(key); - if (!(MTI_KEEP_KEY & mdd_env_info(env)->mti_flags)) - snprintf(key, sizeof(mdd_env_info(env)->mti_key), + if (!(MTI_KEEP_KEY & mdd_env_info(env)->mdi_flags)) + snprintf(key, sizeof(mdd_env_info(env)->mdi_key), DFID_NOBRACE, PFID(lf)); return (struct dt_key *)key; @@ -71,11 +71,11 @@ static struct dt_key *mdd_orphan_key_fill(const struct lu_env *env, static struct dt_key *mdd_orphan_key_fill_20(const struct lu_env *env, const struct lu_fid *lf) { - char *key = mdd_env_info(env)->mti_key; + char *key = mdd_env_info(env)->mdi_key; LASSERT(key); - if (!(MTI_KEEP_KEY & mdd_env_info(env)->mti_flags)) - snprintf(key, sizeof(mdd_env_info(env)->mti_key), + if (!(MTI_KEEP_KEY & mdd_env_info(env)->mdi_flags)) + snprintf(key, sizeof(mdd_env_info(env)->mdi_key), ORPHAN_FILE_NAME_FORMAT_20, fid_seq(lf), fid_oid(lf), fid_ver(lf), ORPH_OP_UNLINK); @@ -88,7 +88,7 @@ static inline int mdd_orphan_insert_obj(const struct lu_env *env, struct mdd_object *obj, struct thandle *th) { - struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec; + struct dt_insert_rec *rec = &mdd_env_info(env)->mdi_dt_rec; struct dt_object *dor = mdd->mdd_orphans; const struct lu_fid *lf = mdd_object_fid(obj); struct dt_key *key = mdd_orphan_key_fill(env, lf); @@ -102,7 +102,7 @@ static inline int mdd_orphan_insert_obj(const struct lu_env *env, int mdd_orphan_declare_insert(const struct lu_env *env, struct mdd_object *obj, umode_t mode, struct thandle *th) { - struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec; + struct dt_insert_rec *rec = &mdd_env_info(env)->mdi_dt_rec; struct mdd_device *mdd = mdo2mdd(&obj->mod_obj); struct dt_key *key; int rc; @@ -159,7 +159,7 @@ int mdd_orphan_insert(const struct lu_env *env, struct mdd_object *obj, struct dt_object *dor = mdd->mdd_orphans; const struct lu_fid *lf_dor = lu_object_fid(&dor->do_lu); struct dt_object *next = mdd_object_child(obj); - struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec; + struct dt_insert_rec *rec = &mdd_env_info(env)->mdi_dt_rec; int rc; ENTRY; @@ -401,7 +401,7 @@ static int mdd_orphan_index_iterate(const struct lu_env *env, { struct mdd_device *mdd = (struct mdd_device *)thread->mgt_data; struct dt_object *dor = mdd->mdd_orphans; - struct lu_dirent *ent = &mdd_env_info(env)->mti_ent; + struct lu_dirent *ent = &mdd_env_info(env)->mdi_ent; const struct dt_it_ops *iops; struct dt_it *it; struct lu_fid fid; @@ -428,7 +428,7 @@ static int mdd_orphan_index_iterate(const struct lu_env *env, GOTO(out_put, rc = -EIO); } - mdd_env_info(env)->mti_flags |= MTI_KEEP_KEY; + mdd_env_info(env)->mdi_flags |= MTI_KEEP_KEY; do { if (thread->mgt_abort) break; -- 1.8.3.1