From: Dmitry Eremin Date: Fri, 10 Oct 2014 19:15:24 +0000 (+0400) Subject: LU-5577 mdd: lu_dirent_calc_size() return type to size_t X-Git-Tag: 2.6.90~12 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c63d9ee84ef7150f277b955cb0f9dca2f9d876fe LU-5577 mdd: lu_dirent_calc_size() return type to size_t Change the type accordant usage. Signed-off-by: Dmitry Eremin Change-Id: I2451940225dd30015928cf85a2e0cc0e6cc8dfeb Reviewed-on: http://review.whamcloud.com/12383 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 9d695a79..7eb21be 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1086,12 +1086,12 @@ static inline struct lu_dirent *lu_dirent_next(struct lu_dirent *ent) return next; } -static inline int lu_dirent_calc_size(int namelen, __u16 attr) +static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr) { - int size; + size_t size; - if (attr & LUDA_TYPE) { - const unsigned align = sizeof(struct luda_type) - 1; + if (attr & LUDA_TYPE) { + const size_t align = sizeof(struct luda_type) - 1; size = (sizeof(struct lu_dirent) + namelen + align) & ~align; size += sizeof(struct luda_type); } else @@ -1100,15 +1100,6 @@ static inline int lu_dirent_calc_size(int namelen, __u16 attr) return (size + 7) & ~7; } -static inline int lu_dirent_size(const struct lu_dirent *ent) -{ - if (le16_to_cpu(ent->lde_reclen) == 0) { - return lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen), - le32_to_cpu(ent->lde_attrs)); - } - return le16_to_cpu(ent->lde_reclen); -} - #define MDS_DIR_END_OFF 0xfffffffffffffffeULL /** diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 54f5b67..6681ecf 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2399,7 +2399,7 @@ static int lmv_read_striped_page(struct obd_export *exp, int ent_idx = 0; struct lu_dirent *min_ent = NULL; struct lu_dirent *last_ent; - int left_bytes; + size_t left_bytes; int rc; ENTRY; diff --git a/lustre/mdd/mdd_compat.c b/lustre/mdd/mdd_compat.c index 023ffa5..9c2cc1c 100644 --- a/lustre/mdd/mdd_compat.c +++ b/lustre/mdd/mdd_compat.c @@ -231,13 +231,15 @@ static int mdd_fix_children(const struct lu_env *env, GOTO(out_put, rc); do { + size_t lu_dirent_size; + rc = iops->key_size(env, it); if (rc == 0) goto next; /* calculate max space required for lu_dirent */ - rc = lu_dirent_calc_size(rc, 0); - LASSERT(rc <= sizeof(info->mti_xattr_buf)); + lu_dirent_size = lu_dirent_calc_size(rc, 0); + LASSERT(lu_dirent_size <= sizeof(info->mti_xattr_buf)); rc = iops->rec(env, it, (struct dt_rec *)ent, LUDA_TYPE); if (rc == 0) { diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index fd6f2de..210a00e 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -999,7 +999,8 @@ static int osd_dir_it_rec_size(const struct lu_env *env, const struct dt_it *di, { struct osd_zap_it *it = (struct osd_zap_it *)di; zap_attribute_t *za = &osd_oti_get(env)->oti_za; - int rc, namelen = 0; + size_t namelen = 0; + int rc; ENTRY; if (it->ozi_pos <= 1) diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index a66dd65..b8d2da9 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -851,7 +851,7 @@ static int osp_md_index_it_rec(const struct lu_env *env, const struct dt_it *di, { struct osp_it *it = (struct osp_it *)di; struct lu_dirent *ent = (struct lu_dirent *)it->ooi_ent; - int reclen; + size_t reclen; reclen = lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen), attr); memcpy(rec, ent, reclen);