From: Andreas Dilger <adil...@whamcloud.com> Remove the usage of LASSERT() and CLASSERT() from lustre_idl.h, so that it is usable from userspace programs if needed. These have crept in over the years, but are not intended to be there.
The CLASSERT() checks for fid swabbing were largely redundant, and have been moved to lustre/fid/fid_handler.c. The fid_is_sane() macro has been modified to remove the check that f_ver == 0, since this will eventually not be true, and the client or server should not crash if it sees such a FID during usage. There are still a few LASSERTs that need to be removed when FID-on-OST is landed, but I don't want to remove them before that code lands. There are also uses of CERROR() that could be removed at that time. Lustre-change: http://review.whamcloud.com/5682 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1606 Signed-off-by: Andreas Dilger <adil...@whamcloud.com> Signed-off-by: John L. Hammond <john.hamm...@intel.com> Reviewed-by: Andreas Dilger <andreas.dil...@intel.com> Reviewed-by: Christopher J. Morrone <chris.morrone.l...@gmail.com> Signed-off-by: Peng Tao <bergw...@gmail.com> Signed-off-by: Andreas Dilger <andreas.dil...@intel.com> --- .../lustre/lustre/include/lustre/lustre_idl.h | 43 ++++---------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 5505cc5..9d3bc29 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -91,8 +91,8 @@ #ifndef _LUSTRE_IDL_H_ #define _LUSTRE_IDL_H_ -#if !defined(LASSERT) && !defined(LPU64) -#include <linux/libcfs/libcfs.h> /* for LASSERT, LPUX64, etc */ +#if !defined(LPU64) +#include <linux/libcfs/libcfs.h> /* for LPUX64, etc */ #endif /* Defn's shared with user-space. */ @@ -231,7 +231,6 @@ static inline unsigned fld_range_is_any(const struct lu_seq_range *range) static inline void fld_range_set_type(struct lu_seq_range *range, unsigned flags) { - LASSERT(!(flags & ~LU_SEQ_RANGE_MASK)); range->lsr_flags |= flags; } @@ -615,7 +614,6 @@ static inline obd_id fid_idif_id(obd_seq seq, __u32 oid, __u32 ver) /* extract ost index from IDIF FID */ static inline __u32 fid_idif_ost_idx(const struct lu_fid *fid) { - LASSERT(fid_is_idif(fid)); return (fid_seq(fid) >> 16) & 0xffff; } @@ -833,11 +831,6 @@ static inline void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen) */ static inline void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src) { - /* check that all fields are converted */ - CLASSERT(sizeof(*src) == - sizeof(fid_seq(src)) + - sizeof(fid_oid(src)) + - sizeof(fid_ver(src))); dst->f_seq = cpu_to_le64(fid_seq(src)); dst->f_oid = cpu_to_le32(fid_oid(src)); dst->f_ver = cpu_to_le32(fid_ver(src)); @@ -845,11 +838,6 @@ static inline void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src) static inline void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src) { - /* check that all fields are converted */ - CLASSERT(sizeof(*src) == - sizeof(fid_seq(src)) + - sizeof(fid_oid(src)) + - sizeof(fid_ver(src))); dst->f_seq = le64_to_cpu(fid_seq(src)); dst->f_oid = le32_to_cpu(fid_oid(src)); dst->f_ver = le32_to_cpu(fid_ver(src)); @@ -857,11 +845,6 @@ static inline void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src) static inline void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src) { - /* check that all fields are converted */ - CLASSERT(sizeof(*src) == - sizeof(fid_seq(src)) + - sizeof(fid_oid(src)) + - sizeof(fid_ver(src))); dst->f_seq = cpu_to_be64(fid_seq(src)); dst->f_oid = cpu_to_be32(fid_oid(src)); dst->f_ver = cpu_to_be32(fid_ver(src)); @@ -869,11 +852,6 @@ static inline void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src) static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src) { - /* check that all fields are converted */ - CLASSERT(sizeof(*src) == - sizeof(fid_seq(src)) + - sizeof(fid_oid(src)) + - sizeof(fid_ver(src))); dst->f_seq = be64_to_cpu(fid_seq(src)); dst->f_oid = be32_to_cpu(fid_oid(src)); dst->f_ver = be32_to_cpu(fid_ver(src)); @@ -897,11 +875,6 @@ extern void lustre_swab_lu_seq_range(struct lu_seq_range *range); static inline int lu_fid_eq(const struct lu_fid *f0, const struct lu_fid *f1) { - /* Check that there is no alignment padding. */ - CLASSERT(sizeof(*f0) == - sizeof(f0->f_seq) + - sizeof(f0->f_oid) + - sizeof(f0->f_ver)); return memcmp(f0, f1, sizeof(*f0)) == 0; } @@ -3315,9 +3288,10 @@ struct obdo { #define o_grant_used o_data_version static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd, - struct obdo *wobdo, struct obdo *lobdo) + struct obdo *wobdo, + const struct obdo *lobdo) { - memcpy(wobdo, lobdo, sizeof(*lobdo)); + *wobdo = *lobdo; wobdo->o_flags &= ~OBD_FL_LOCAL_MASK; if (ocd == NULL) return; @@ -3332,16 +3306,15 @@ static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd, } static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd, - struct obdo *lobdo, struct obdo *wobdo) + struct obdo *lobdo, + const struct obdo *wobdo) { obd_flag local_flags = 0; if (lobdo->o_valid & OBD_MD_FLFLAGS) local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK; - LASSERT(!(wobdo->o_flags & OBD_FL_LOCAL_MASK)); - - memcpy(lobdo, wobdo, sizeof(*lobdo)); + *lobdo = *wobdo; if (local_flags != 0) { lobdo->o_valid |= OBD_MD_FLFLAGS; lobdo->o_flags &= ~OBD_FL_LOCAL_MASK; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/