static int cmm_add_mdc(const struct lu_context *ctx,
struct cmm_device *cm, struct lustre_cfg *cfg)
{
- struct lu_device_type *ldt = &mdc_device_type;
- struct lu_device *ld;
- struct mdc_device *mc, *tmp;
- __u32 mdc_num;
+ struct lu_device_type *ldt = &mdc_device_type;
+ struct lu_device *ld;
+ struct mdc_device *mc, *tmp;
+ mdsno_t mdc_num;
int rc;
ENTRY;
/* underlaying device in MDS stack, usually MDD */
struct md_device *cmm_child;
/* other MD servers in cluster */
- __u32 cmm_local_num;
+ mdsno_t cmm_local_num;
__u32 cmm_tgt_count;
struct list_head cmm_targets;
spinlock_t cmm_tgt_guard;
struct cmr_object {
struct cmm_object cmm_obj;
/* mds number where object is placed */
- __u32 cmo_num;
+ mdsno_t cmo_num;
};
static inline struct cmm_device *cmm_obj2dev(struct cmm_object *c)
return !range_within(space, fid_seq(fid));
}
-static int cmm_fld_lookup(struct cmm_device *cm,
- const struct lu_fid *fid)
+static int cmm_fld_lookup(struct cmm_device *cm,
+ const struct lu_fid *fid, mdsno_t *mds)
{
- __u64 mds;
- int rc;
+ int rc = 0;
ENTRY;
LASSERT(fid_is_sane(fid));
/* XXX: is this correct? We need this to prevent FLD lookups while CMM
* did not initialized yet all MDCs. */
if (cmm_special_fid(fid))
- mds = 0;
+ *mds = 0;
else {
- rc = fld_client_lookup(&cm->cmm_fld, fid_seq(fid), &mds);
+ rc = fld_client_lookup(&cm->cmm_fld, fid_seq(fid), mds);
if (rc) {
CERROR("can't find mds by seq "LPU64", rc %d\n",
fid_seq(fid), rc);
RETURN(rc);
}
}
- CWARN("CMM: got MDS "LPU64" for sequence: "LPU64"\n",
- mds, fid_seq(fid));
- RETURN((int)mds);
+ if (*mds >= cm->cmm_tgt_count) {
+ CERROR("Got invalid mdsno: %u (max: %u)\n",
+ *mds, cm->cmm_tgt_count);
+ rc = -EINVAL;
+ } else {
+ CDEBUG(D_INFO, "CMM: got MDS %u for sequence: "LPU64"\n",
+ *mds, fid_seq(fid));
+ }
+
+ RETURN (rc);
}
static struct md_object_operations cml_mo_ops;
struct lu_object *lo = NULL;
const struct lu_fid *fid = &loh->loh_fid;
struct cmm_device *cd;
- int mdsnum;
+ mdsno_t mdsnum;
+ int rc = 0;
+
ENTRY;
cd = lu2cmm_dev(ld);
if (cd->cmm_flags & CMM_INITIALIZED) {
/* get object location */
- mdsnum = cmm_fld_lookup(lu2cmm_dev(ld), fid);
- if (mdsnum < 0)
- RETURN(ERR_PTR(mdsnum));
+ rc = cmm_fld_lookup(lu2cmm_dev(ld), fid, &mdsnum);
+ if (rc)
+ RETURN(ERR_PTR(rc));
} else
/*
* Device is not yet initialized, cmm_object is being created
struct md_device mc_md_dev;
/* other MD servers in cluster */
struct list_head mc_linkage;
- __u32 mc_num;
+ mdsno_t mc_num;
struct mdc_cli_desc mc_desc;
};
#include <linux/types.h>
-typedef __u64 mdsno_t;
typedef __u64 fidseq_t;
struct fld_cache {
struct hlist_node fld_list;
- __u64 fld_mds;
+ mdsno_t fld_mds;
__u64 fld_seq;
};
struct fld_item {
struct list_head fld_list;
- __u64 fld_seq;
- __u64 fld_mds;
+ __u64 fld_seq;
+ mdsno_t fld_mds;
};
enum fld_op {
int
fld_client_create(struct lu_client_fld *fld,
- __u64 seq, __u64 mds)
+ __u64 seq, mdsno_t mds)
{
struct obd_export *fld_exp;
struct md_fld md_fld;
int
fld_client_delete(struct lu_client_fld *fld,
- __u64 seq, __u64 mds)
+ __u64 seq, mdsno_t mds)
{
struct obd_export *fld_exp;
struct md_fld md_fld;
static int
fld_client_get(struct lu_client_fld *fld,
- __u64 seq, __u64 *mds)
+ __u64 seq, mdsno_t *mds)
{
struct obd_export *fld_exp;
struct md_fld md_fld;
/* lookup fid in the namespace of pfid according to the name */
int
fld_client_lookup(struct lu_client_fld *fld,
- __u64 seq, __u64 *mds)
+ __u64 seq, mdsno_t *mds)
{
#ifdef __KERNEL__
struct fld_cache *fld_entry;
#define LUSTRE_LOG_VERSION 0x00050000
#define LUSTRE_MGS_VERSION 0x00060000
+typedef __u64 mdsno_t;
+
struct lu_range {
__u64 lr_start;
__u64 lr_end;
/* end adding MDT by huanghua@clusterfs.com */
struct md_fld {
- __u64 mf_seq;
- __u64 mf_mds;
+ __u64 mf_seq;
+ mdsno_t mf_mds;
};
extern void lustre_swab_md_fld (struct md_fld *mf);
struct obd_export *exp);
int fld_client_create(struct lu_client_fld *fld,
- __u64 seq, __u64 mds);
+ __u64 seq, mdsno_t mds);
int fld_client_delete(struct lu_client_fld *fld,
- __u64 seq, __u64 mds);
+ __u64 seq, mdsno_t mds);
int fld_client_lookup(struct lu_client_fld *fld,
- __u64 seq, __u64 *mds);
+ __u64 seq, mdsno_t *mds);
#endif
int lmv_fld_lookup(struct obd_device *obd, const struct lu_fid *fid)
{
struct lmv_obd *lmv = &obd->u.lmv;
- __u64 mds;
+ mdsno_t mds;
int rc;
ENTRY;
fid_seq(fid), rc);
RETURN(rc);
}
- CDEBUG(D_WARNING, "LMV: got MDS "LPU64" for sequence: "LPU64"\n",
+ CDEBUG(D_WARNING, "LMV: got MDS %u for sequence: "LPU64"\n",
mds, fid_seq(fid));
- if (mds >= lmv->desc.ld_tgt_count || mds < 0) {
- CERROR("Got invalid mdsno: %llu (max: %d)\n",
+ if (mds >= lmv->desc.ld_tgt_count) {
+ CERROR("Got invalid mdsno: %u (max: %d)\n",
mds, lmv->desc.ld_tgt_count);
mds = (__u64)-EINVAL;
}