Skip to content

Commit

Permalink
staging/lustre/idl: remove LASSERT/CLASSERT from lustre_idl.h
Browse files Browse the repository at this point in the history
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.

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 <[email protected]>
Signed-off-by: John L. Hammond <[email protected]>
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Christopher J. Morrone <[email protected]>
Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Andreas Dilger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
adilger authored and gregkh committed Feb 7, 2014
1 parent b0337d6 commit f3418ce
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -232,7 +232,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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -833,47 +831,27 @@ 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));
}

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));
}

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));
}

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));
Expand All @@ -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;
}

Expand Down Expand Up @@ -3328,9 +3301,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;
Expand All @@ -3345,16 +3319,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;
Expand Down

0 comments on commit f3418ce

Please sign in to comment.