From 9f8012b116a94433f4a24be6a700605b3b1bea3e Mon Sep 17 00:00:00 2001 From: yury Date: Sun, 15 Oct 2006 09:52:46 +0000 Subject: [PATCH] - some cleanups; - added debug messages to fld --- lustre/cmm/cmm_split.c | 2 +- lustre/fld/fld_handler.c | 8 +++----- lustre/fld/fld_request.c | 6 +++--- lustre/include/md_object.h | 8 ++++---- lustre/lmv/lmv_intent.c | 2 +- lustre/mdc/mdc_request.c | 3 ++- lustre/mdd/mdd_handler.c | 36 ++++++++++++++++++++---------------- 7 files changed, 34 insertions(+), 31 deletions(-) diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 8677a15..d96e686 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -559,7 +559,7 @@ int cml_try_to_split(const struct lu_env *env, struct md_object *mo) LASSERT(S_ISDIR(lu_object_attr(&mo->mo_lu))); memset(ma, 0, sizeof(*ma)); - ma->ma_need = MA_INODE|MA_LMV; + ma->ma_need = MA_INODE | MA_LMV; rc = mo_attr_get(env, mo, ma); if (rc) GOTO(cleanup, ma); diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index 67f08d9..59d8ce9 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -164,11 +164,9 @@ static int fld_server_handle(struct lu_server_fld *fld, rc = -EINVAL; break; } - if (rc) { - CERROR("%s: FLD req handle error %d (opc: %d, seq: " - LPX64", mds: "LPU64")\n", fld->lsf_name, rc, - opc, mf->mf_seq, mf->mf_mds); - } + CDEBUG(D_INFO|D_WARNING, "%s: FLD req handle error %d (opc: %d, seq: " + LPX64", mds: "LPU64")\n", fld->lsf_name, rc, + opc, mf->mf_seq, mf->mf_mds); RETURN(rc); } diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index c9155b8..5b23b9c 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -446,7 +446,7 @@ int fld_client_create(struct lu_client_fld *fld, target = fld_client_get_target(fld, seq); LASSERT(target != NULL); - CDEBUG(D_INFO, "%s: Create fld entry (seq: "LPX64"; mds: " + CDEBUG(D_INFO|D_WARNING, "%s: Create fld entry (seq: "LPX64"; mds: " LPX64") on target %s (idx "LPU64")\n", fld->lcf_name, seq, mds, fld_target_name(target), target->ft_idx); @@ -492,7 +492,7 @@ int fld_client_delete(struct lu_client_fld *fld, seqno_t seq, target = fld_client_get_target(fld, seq); LASSERT(target != NULL); - CDEBUG(D_INFO, "%s: Delete fld entry (seq: "LPX64") on " + CDEBUG(D_INFO|D_WARNING, "%s: Delete fld entry (seq: "LPX64") on " "target %s (idx "LPU64")\n", fld->lcf_name, seq, fld_target_name(target), target->ft_idx); @@ -531,7 +531,7 @@ int fld_client_lookup(struct lu_client_fld *fld, target = fld_client_get_target(fld, seq); LASSERT(target != NULL); - CDEBUG(D_INFO, "%s: Lookup fld entry (seq: "LPX64") on " + CDEBUG(D_INFO|D_WARNING, "%s: Lookup fld entry (seq: "LPX64") on " "target %s (idx "LPU64")\n", fld->lcf_name, seq, fld_target_name(target), target->ft_idx); diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index d994cb3..c4e6718 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -93,11 +93,11 @@ struct md_capainfo *md_capainfo(const struct lu_env *env); /* metadata attributes */ enum ma_valid { - MA_INODE = (1 << 0), - MA_LOV = (1 << 1), + MA_INODE = (1 << 0), + MA_LOV = (1 << 1), MA_COOKIE = (1 << 2), - MA_FLAGS = (1 << 3), - MA_LMV = (1 << 4) + MA_FLAGS = (1 << 3), + MA_LMV = (1 << 4) }; struct md_attr { diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 2f3b296..b5a1a76 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -167,7 +167,7 @@ int lmv_alloc_fid_for_split(struct obd_device *obd, struct lu_fid *pid, GOTO(cleanup, rc); } } - if (rc >= 0) { + if (rc == 0) { CDEBUG(D_INFO, "Allocate new fid "DFID" for split " "obj\n", PFID(fid)); } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 2488c55..a2c9bd12 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -529,10 +529,11 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, } else if (md->body->valid & OBD_MD_FLDIREA) { int lmvsize; struct lov_mds_md *lmv; + LASSERT(S_ISDIR(md->body->mode)); if (md->body->eadatasize == 0) { - CERROR("OBD_MD_FLEASIZE set, but eadatasize 0\n"); + CERROR("OBD_MD_FLEASIZE is set, but eadatasize 0\n"); RETURN(-EPROTO); } if (md->body->valid & OBD_MD_MEA) { diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 0ac548f..44e7ddf 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -1450,14 +1450,15 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj, fl, handle); #ifdef HAVE_SPLIT_SUPPORT if (rc == 0) { - /* very ugly hack, if setting lmv, it means splitting - * sucess, we should return -ERESTART to notify the - * client, so transno for this splitting should be - * zero according to the replay rules. so return -ERESTART - * here let mdt trans stop callback know this. + /* + * XXX: Very ugly hack, if setting lmv, it means splitting + * sucess, we should return -ERESTART to notify the client, so + * transno for this splitting should be zero according to the + * replay rules. so return -ERESTART here let mdt trans stop + * callback know this. */ if (strncmp(name, MDS_LMV_MD_NAME, strlen(name)) == 0) - rc = -ERESTART; + rc = -ERESTART; } #endif mdd_trans_stop(env, mdd, rc, handle); @@ -2289,10 +2290,11 @@ static int mdd_create_data(const struct lu_env *env, if (IS_ERR(handle)) RETURN(rc = PTR_ERR(handle)); - /*XXX: setting the lov ea is not locked - * but setting the attr is locked? */ + /* + * XXX: Setting the lov ea is not locked but setting the attr is locked? + */ - /* replay creates has objects already */ + /* Replay creates has objects already */ if (spec->u.sp_ea.no_lov_create) { CDEBUG(D_INFO, "we already have lov ea\n"); rc = mdd_lov_set_md(env, mdd_pobj, son, @@ -2305,7 +2307,7 @@ static int mdd_create_data(const struct lu_env *env, if (rc == 0) rc = mdd_attr_get_internal_locked(env, son, ma); - /* finish mdd_lov_create() stuff */ + /* Finish mdd_lov_create() stuff. */ mdd_lov_create_finish(env, mdd, rc); mdd_trans_stop(env, mdd, rc, handle); if (lmm) @@ -2574,8 +2576,8 @@ static int mdd_object_create(const struct lu_env *env, struct mdd_device *mdd = mdo2mdd(obj); struct mdd_object *mdd_obj = md2mdd_obj(obj); - struct thandle *handle; const struct lu_fid *pfid = spec->u.sp_pfid; + struct thandle *handle; int rc; ENTRY; @@ -2594,31 +2596,33 @@ static int mdd_object_create(const struct lu_env *env, GOTO(unlock, rc); if (spec->sp_cr_flags & MDS_CREATE_SLAVE_OBJ) { - /* if creating the slave object, set slave EA here */ + /* If creating the slave object, set slave EA here. */ int lmv_size = spec->u.sp_ea.eadatalen; struct lmv_stripe_md *lmv; lmv = (struct lmv_stripe_md *)spec->u.sp_ea.eadata; LASSERT(lmv != NULL && lmv_size > 0); + rc = __mdd_xattr_set(env, mdd_obj, mdd_buf_get_const(env, lmv, lmv_size), MDS_LMV_MD_NAME, 0, handle); if (rc) GOTO(unlock, rc); pfid = spec->u.sp_ea.fid; - - CWARN("Set slave ea "DFID", eadatalen %d, rc %d\n", - PFID(mdo2fid(mdd_obj)), spec->u.sp_ea.eadatalen, rc); + + CDEBUG(D_INFO, "Set slave ea "DFID", eadatalen %d, rc %d\n", + PFID(mdo2fid(mdd_obj)), spec->u.sp_ea.eadatalen, rc); rc = mdd_attr_set_internal(env, mdd_obj, &ma->ma_attr, handle); } else rc = __mdd_object_initialize(env, pfid, mdd_obj, ma, handle); + EXIT; unlock: mdd_write_unlock(env, mdd_obj); if (rc == 0) rc = mdd_attr_get_internal_locked(env, mdd_obj, ma); mdd_trans_stop(env, mdd, rc, handle); - RETURN(rc); + return rc; } /* -- 1.8.3.1