Commit c5b60ba7 authored by Andreas Dilger's avatar Andreas Dilger Committed by Greg Kroah-Hartman

staging/lustre/ldlm: print FID in lvbo_init(), lvbo_update

Print the namespace and OBD device name, as well as the first two
lock resource fields (typically the FID) if there is an error with
loading the object from disk.  This will be more important with
FID-on-OST and also the MDS.  Using fid_extract_from_res_name() isn't
possible in the LDLM code, since the lock resource may not be a FID.

Make fid_extract_quota_resid() argument order and name consistent
with other fid_*_res() functions, with FID first and resource second.

Fix a bug in ofd_lvbo_init() where NULL lvb is accessed on error.

Print FID in ofd_lvbo_update() CDEBUG() and CERROR() messages.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2193
Lustre-change: http://review.whamcloud.com/4501Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 79a8726a
......@@ -911,7 +911,7 @@ static inline int lu_fid_cmp(const struct lu_fid *f0,
__diff_normalize(fid_ver(f0), fid_ver(f1));
}
static inline void ostid_cpu_to_le(struct ost_id *src_oi,
static inline void ostid_cpu_to_le(const struct ost_id *src_oi,
struct ost_id *dst_oi)
{
if (fid_seq_is_mdt0(ostid_seq(src_oi))) {
......@@ -922,7 +922,7 @@ static inline void ostid_cpu_to_le(struct ost_id *src_oi,
}
}
static inline void ostid_le_to_cpu(struct ost_id *src_oi,
static inline void ostid_le_to_cpu(const struct ost_id *src_oi,
struct ost_id *dst_oi)
{
if (fid_seq_is_mdt0(ostid_seq(src_oi))) {
......
......@@ -488,74 +488,75 @@ struct ldlm_namespace;
* renaming name[2,3] fields that need to be used for the quota identifier.
*/
static inline struct ldlm_res_id *
fid_build_reg_res_name(const struct lu_fid *f,
struct ldlm_res_id *name)
fid_build_reg_res_name(const struct lu_fid *fid, struct ldlm_res_id *res)
{
memset(name, 0, sizeof *name);
name->name[LUSTRE_RES_ID_SEQ_OFF] = fid_seq(f);
name->name[LUSTRE_RES_ID_VER_OID_OFF] = fid_ver_oid(f);
return name;
memset(res, 0, sizeof(*res));
res->name[LUSTRE_RES_ID_SEQ_OFF] = fid_seq(fid);
res->name[LUSTRE_RES_ID_VER_OID_OFF] = fid_ver_oid(fid);
return res;
}
/*
* Return true if resource is for object identified by FID.
*/
static inline int fid_res_name_eq(const struct lu_fid *fid,
const struct ldlm_res_id *res)
{
return res->name[LUSTRE_RES_ID_SEQ_OFF] == fid_seq(fid) &&
res->name[LUSTRE_RES_ID_VER_OID_OFF] == fid_ver_oid(fid);
}
/*
* Extract FID from LDLM resource. Reverse of fid_build_reg_res_name().
*/
static inline struct lu_fid *
fid_extract_from_res_name(struct lu_fid *fid, const struct ldlm_res_id *res)
{
fid->f_seq = res->name[LUSTRE_RES_ID_SEQ_OFF];
fid->f_oid = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF]);
fid->f_ver = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32);
LASSERT(fid_res_name_eq(fid, res));
return fid;
}
/*
* Build (DLM) resource identifier from global quota FID and quota ID.
*/
static inline struct ldlm_res_id *
fid_build_quota_resid(const struct lu_fid *glb_fid, union lquota_id *qid,
fid_build_quota_res_name(const struct lu_fid *glb_fid, union lquota_id *qid,
struct ldlm_res_id *res)
{
fid_build_reg_res_name(glb_fid, res);
res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF] = fid_seq(&qid->qid_fid);
res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] = fid_ver_oid(&qid->qid_fid);
return res;
}
/*
* Extract global FID and quota ID from resource name
*/
static inline void fid_extract_quota_resid(struct ldlm_res_id *res,
struct lu_fid *glb_fid,
union lquota_id *qid)
static inline void fid_extract_from_quota_res(struct lu_fid *glb_fid,
union lquota_id *qid,
const struct ldlm_res_id *res)
{
glb_fid->f_seq = res->name[LUSTRE_RES_ID_SEQ_OFF];
glb_fid->f_oid = (__u32)res->name[LUSTRE_RES_ID_VER_OID_OFF];
glb_fid->f_ver = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32);
fid_extract_from_res_name(glb_fid, res);
qid->qid_fid.f_seq = res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF];
qid->qid_fid.f_oid = (__u32)res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF];
qid->qid_fid.f_ver =
(__u32)(res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] >> 32);
}
/*
* Return true if resource is for object identified by fid.
*/
static inline int fid_res_name_eq(const struct lu_fid *f,
const struct ldlm_res_id *name)
{
return name->name[LUSTRE_RES_ID_SEQ_OFF] == fid_seq(f) &&
name->name[LUSTRE_RES_ID_VER_OID_OFF] == fid_ver_oid(f);
}
/* reverse function of fid_build_reg_res_name() */
static inline void fid_build_from_res_name(struct lu_fid *f,
const struct ldlm_res_id *name)
{
fid_zero(f);
f->f_seq = name->name[LUSTRE_RES_ID_SEQ_OFF];
f->f_oid = name->name[LUSTRE_RES_ID_VER_OID_OFF] & 0xffffffff;
f->f_ver = name->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32;
LASSERT(fid_res_name_eq(f, name));
}
static inline struct ldlm_res_id *
fid_build_pdo_res_name(const struct lu_fid *f,
unsigned int hash,
struct ldlm_res_id *name)
fid_build_pdo_res_name(const struct lu_fid *fid, unsigned int hash,
struct ldlm_res_id *res)
{
fid_build_reg_res_name(f, name);
name->name[LUSTRE_RES_ID_HSH_OFF] = hash;
return name;
fid_build_reg_res_name(fid, res);
res->name[LUSTRE_RES_ID_HSH_OFF] = hash;
return res;
}
/**
......@@ -584,7 +585,7 @@ static inline void ostid_build_res_name(struct ost_id *oi,
name->name[LUSTRE_RES_ID_SEQ_OFF] = ostid_id(oi);
name->name[LUSTRE_RES_ID_VER_OID_OFF] = ostid_seq(oi);
} else {
fid_build_reg_res_name((struct lu_fid *)oi, name);
fid_build_reg_res_name(&oi->oi_fid, name);
}
}
......@@ -597,7 +598,7 @@ static inline void ostid_res_name_to_id(struct ost_id *oi,
ostid_set_id(oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
} else {
/* new resid */
fid_build_from_res_name((struct lu_fid *)oi, name);
fid_extract_from_res_name(&oi->oi_fid, name);
}
}
......@@ -644,7 +645,7 @@ static inline void ost_fid_from_resid(struct lu_fid *fid,
ostid_to_fid(fid, &oi, 0);
} else {
/* new resid */
fid_build_from_res_name(fid, name);
fid_extract_from_res_name(fid, name);
}
}
......
......@@ -1128,8 +1128,9 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CREATE_RESOURCE, 2);
rc = ns->ns_lvbo->lvbo_init(res);
if (rc < 0) {
CERROR("lvbo_init failed for resource "
LPU64": rc %d\n", name->name[0], rc);
CERROR("%s: lvbo_init failed for resource "LPX64":"
LPX64": rc = %d\n", ns->ns_obd->obd_name,
name->name[0], name->name[1], rc);
if (res->lr_lvb_data) {
OBD_FREE(res->lr_lvb_data, res->lr_lvb_len);
res->lr_lvb_data = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment