From 17797975b27e1b5222fb75cac49d90066091486d Mon Sep 17 00:00:00 2001 From: wang di Date: Wed, 7 May 2014 13:23:11 -0700 Subject: [PATCH] LU-4690 osp: some cleanup for patch 9511 cleanup patch 9511 according to the review 1. fix endian problem in osd-zfs and osp. 2. Few tab and typo fixes. 3. move mti_big_lmm_used back to mdt_stripe_get, set it in mdt_big_xattr_get is a bit risky. Signed-off-by: wang di Change-Id: I85982bf198dddc9e0442e392f3da25cca46dfe03 Reviewed-on: http://review.whamcloud.com/10261 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_obd.c | 2 +- lustre/lod/lod_object.c | 10 +++++----- lustre/mdd/mdd_dir.c | 4 ++-- lustre/mdt/mdt_handler.c | 3 +-- lustre/osd-ldiskfs/osd_handler.c | 4 ++-- lustre/osd-zfs/osd_index.c | 4 ++-- lustre/osp/osp_md_object.c | 2 +- lustre/utils/liblustreapi.c | 16 ++++++++-------- 8 files changed, 22 insertions(+), 23 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index b89a40a..a48307f 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1368,7 +1368,7 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, GOTO(out, rc = -ENODEV); /* - * Asking underlaying tgt layer to allocate new fid. + * Asking underlying tgt layer to allocate new fid. */ rc = obd_fid_alloc(NULL, tgt->ltd_exp, fid, NULL); if (rc > 0) { diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 8b51dd8..d5d09b0 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -260,12 +260,12 @@ static struct dt_index_operations lod_index_ops = { * \param[in] env execution environment. * \param[in] dt the striped directory object to be iterated. * \param[in] attr the attribute of iterator, mostly used to indicate - * the entry attribute in the object to be iterated. + * the entry attribute in the object to be iterated. * \param[in] capa capability(useless in current implementation) * * \retval initialized iterator(dt_it) if successful initialize the - * iteration. lit_stripe_index will be used to indicate the - * current iterate position among stripes. + * iteration. lit_stripe_index will be used to indicate the + * current iterate position among stripes. * \retval ERR pointer if initialization is failed. */ static struct dt_it *lod_striped_it_init(const struct lu_env *env, @@ -538,7 +538,7 @@ static int lod_striped_it_key_size(const struct lu_env *env, * \param[in] env execution environment. * \param[in] di the iterator for striped directory. * \param[in] attr the attribute of iterator, mostly used to indicate - * the entry attribute in the object to be iterated. + * the entry attribute in the object to be iterated. * \param[out] rec hold the return record. * * \retval 0 if successfully get the entry. @@ -568,7 +568,7 @@ static int lod_striped_it_rec(const struct lu_env *env, const struct dt_it *di, * \param[in] env execution environment. * \param[in] di the iterator for striped directory. * \param[in] attr the attribute of iterator, mostly used to indicate - * the entry attribute in the object to be iterated. + * the entry attribute in the object to be iterated. * * \retval rec_size if successfully get the entry size. * \retval negative error if can not get entry size. diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 98e4e28..d1009a3 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1872,8 +1872,8 @@ static int mdd_create_sanity_check(const struct lu_env *env, */ rc = __mdd_lookup(env, pobj, pattr, lname, fid, MAY_WRITE | MAY_EXEC); - if (rc != -ENOENT) - RETURN(rc ? : -EEXIST); + if (rc != -ENOENT) + RETURN(rc ? : -EEXIST); } else { rc = mdd_may_create(env, obj, pattr, NULL, true, false); if (rc != 0) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 0c9ab85..6b0c683 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -543,8 +543,6 @@ int mdt_big_xattr_get(struct mdt_thread_info *info, struct mdt_object *o, info->mti_buf.lb_buf = info->mti_big_lmm; info->mti_buf.lb_len = info->mti_big_lmmsize; rc = mo_xattr_get(env, mdt_object_child(o), &info->mti_buf, name); - if (rc > 0) - info->mti_big_lmm_used = 1; RETURN(rc); } @@ -596,6 +594,7 @@ int mdt_stripe_get(struct mdt_thread_info *info, struct mdt_object *o, return rc; rc = mdt_big_xattr_get(info, o, name); if (rc > 0) { + info->mti_big_lmm_used = 1; if (!strcmp(name, XATTR_NAME_LOV)) { ma->ma_valid |= MA_LOV; ma->ma_lmm = info->mti_big_lmm; diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 9d20f5d..46aff66 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -5412,10 +5412,10 @@ static inline int osd_it_ea_rec(const struct lu_env *env, * \param[in] env execution environment * \param[in] di iterator's in memory structure * \param[in] attr attribute of the entry, only requires LUDA_TYPE to - * calculate the lu_dirent size. + * calculate the lu_dirent size. * * \retval record size(in bytes & in memory) of the current lu_dirent - * entry. + * entry. */ static int osd_it_ea_rec_size(const struct lu_env *env, const struct dt_it *di, __u32 attr) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index dd1acf3..7fb8326 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -978,9 +978,9 @@ static int osd_dir_it_rec_size(const struct lu_env *env, const struct dt_it *di, ENTRY; if (it->ozi_pos <= 1) - namelen = cpu_to_le16(1); + namelen = 1; else if (it->ozi_pos == 2) - namelen = cpu_to_le16(2); + namelen = 2; if (namelen > 0) { rc = lu_dirent_calc_size(namelen, attr); diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index 26f8e32..ea5ef0a 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -532,7 +532,7 @@ static int osp_md_index_it_rec(const struct lu_env *env, const struct dt_it *di, struct lu_dirent *ent = (struct lu_dirent *)it->ooi_ent; int reclen; - reclen = lu_dirent_calc_size(ent->lde_namelen, attr); + reclen = lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen), attr); memcpy(rec, ent, reclen); return 0; } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index e9d3b12..97d7fc7 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2387,7 +2387,7 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name, struct lmv_user_mds_data *objects = lum->lum_objects; char *prefix = lum->lum_magic == LMV_USER_MAGIC ? "(Default)" : ""; int i, obdstripe = 0; - char *seperator = ""; + char *separator = ""; if (obdindex != OBD_NOT_FOUND) { for (i = 0; i < lum->lum_stripe_count; i++) { @@ -2414,25 +2414,25 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name, llapi_printf(LLAPI_MSG_NORMAL, "%s%s\n", prefix, path); if (verbose & VERBOSE_COUNT) { - llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator); + llapi_printf(LLAPI_MSG_NORMAL, "%s", separator); if (verbose & ~VERBOSE_COUNT) llapi_printf(LLAPI_MSG_NORMAL, "lmv_stripe_count: "); llapi_printf(LLAPI_MSG_NORMAL, "%u", (int)lum->lum_stripe_count); - seperator = "\n"; + separator = "\n"; } if (verbose & VERBOSE_OFFSET) { - llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator); + llapi_printf(LLAPI_MSG_NORMAL, "%s", separator); if (verbose & ~VERBOSE_OFFSET) llapi_printf(LLAPI_MSG_NORMAL, "lmv_stripe_offset: "); llapi_printf(LLAPI_MSG_NORMAL, "%d", (int)lum->lum_stripe_offset); - seperator = "\n"; + separator = "\n"; } if (verbose & VERBOSE_OBJID && lum->lum_magic != LMV_USER_MAGIC) { - llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator); + llapi_printf(LLAPI_MSG_NORMAL, "%s", separator); if (obdstripe == 1 && lum->lum_stripe_count > 0) llapi_printf(LLAPI_MSG_NORMAL, "mdtidx\t\t FID[seq:oid:ver]\n"); @@ -2449,12 +2449,12 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name, } if ((verbose & VERBOSE_POOL) && (pool_name[0] != '\0')) { - llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator); + llapi_printf(LLAPI_MSG_NORMAL, "%s", separator); if (verbose & ~VERBOSE_POOL) llapi_printf(LLAPI_MSG_NORMAL, "%slmv_pool: ", prefix); llapi_printf(LLAPI_MSG_NORMAL, "%s%c ", pool_name, ' '); - seperator = "\n"; + separator = "\n"; } if (!(verbose & VERBOSE_OBJID)) -- 1.8.3.1