From b04f65ea5f54c24d4bb4f08afd2006ce3d15ff73 Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 21 Sep 2006 10:46:52 +0000 Subject: [PATCH] cosmetic fixes --- lustre/ldlm/ldlm_lock.c | 3 ++- lustre/lmv/lmv_intent.c | 50 ++++++++++++++++++++++++------------------------ lustre/mdd/mdd_handler.c | 35 ++++++++++++++++----------------- lustre/mdt/mdt_lib.c | 30 ++++++++++++++--------------- lustre/mdt/mdt_open.c | 2 +- lustre/ptlrpc/layout.c | 6 +++--- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 16b65fb..f50d30f 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -130,7 +130,8 @@ void ldlm_lock_put(struct ldlm_lock *lock) if (atomic_dec_and_test(&lock->l_refc)) { struct ldlm_resource *res; - LDLM_DEBUG(lock, "final lock_put on destroyed lock, freeing it."); + LDLM_DEBUG(lock, + "final lock_put on destroyed lock, freeing it.\n"); lock_res_and_lock(lock); res = lock->l_resource; diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index fb38c41..dad8e78 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -91,7 +91,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, /* we got LOOKUP lock, but we really need attrs */ pmode = it->d.lustre.it_lock_mode; if (pmode) { - memcpy(&plock, &it->d.lustre.it_lock_handle, sizeof(plock)); + plock.cookie = it->d.lustre.it_lock_handle; it->d.lustre.it_lock_mode = 0; it->d.lustre.it_data = 0; } @@ -103,7 +103,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, OBD_ALLOC_PTR(op_data); if (op_data == NULL) GOTO(out, rc = -ENOMEM); - + op_data->fid1 = body->fid1; tgt_exp = lmv_get_export(lmv, &body->fid1); @@ -120,7 +120,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, */ if (rc == 0) { lmv_drop_intent_lock(it); - memcpy(&it->d.lustre.it_lock_handle, &plock, sizeof(plock)); + it->d.lustre.it_lock_handle = plock.cookie; it->d.lustre.it_lock_mode = pmode; } @@ -154,7 +154,7 @@ int lmv_alloc_fid_for_split(struct obd_device *obd, struct lu_fid *pid, rc = lmv_fld_lookup(lmv, rpid, &mds); if (rc) GOTO(cleanup, rc); - + rc = obd_fid_alloc(lmv->tgts[mds].ltd_exp, fid, NULL); if (rc < 0) GOTO(cleanup, rc); @@ -197,16 +197,16 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, OBD_ALLOC_PTR(sop_data); if (sop_data == NULL) RETURN(-ENOMEM); - + /* save op_data fro repeat case */ *sop_data = *op_data; - + repeat: LASSERT(++loop <= 2); rc = lmv_fld_lookup(lmv, &rpid, &mds); if (rc) GOTO(out_free_sop_data, rc); - + obj = lmv_obj_grab(obd, &rpid); if (obj) { /* @@ -219,9 +219,9 @@ repeat: rpid = obj->lo_inodes[mds].li_fid; rc = lmv_fld_lookup(lmv, &rpid, &mds); lmv_obj_put(obj); - if (rc) + if (rc) GOTO(out_free_sop_data, rc); - + CDEBUG(D_OTHER, "forward to MDS #"LPU64" ("DFID")\n", mds, PFID(&rpid)); } @@ -231,7 +231,7 @@ repeat: rc = md_intent_lock(lmv->tgts[mds].ltd_exp, sop_data, lmm, lmmsize, it, flags, reqp, cb_blocking, extra_lock_flags); - + if (rc == -ERESTART) { /* * Directory got split. Time to update local object and repeat @@ -348,10 +348,10 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, OBD_ALLOC_PTR(sop_data); if (sop_data == NULL) RETURN(-ENOMEM); - + /* save op_data fro repeat case */ *sop_data = *op_data; - + if (fid_is_sane(&op_data->fid2)) { /* * Caller wants to revalidate attrs of obj we have to revalidate @@ -359,7 +359,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, */ CDEBUG(D_OTHER, "revalidate attrs for "DFID"\n", PFID(&op_data->fid2)); - + rc = lmv_fld_lookup(lmv, &op_data->fid2, &mds); if (rc) GOTO(out_free_sop_data, rc); @@ -385,7 +385,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, CDEBUG(D_OTHER, "INTENT getattr for %*s on "DFID"\n", op_data->namelen, op_data->name, PFID(&op_data->fid1)); - + rc = lmv_fld_lookup(lmv, &op_data->fid1, &mds); if (rc) GOTO(out_free_sop_data, rc); @@ -395,7 +395,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount, (char *)op_data->name, op_data->namelen); - + rpid = obj->lo_inodes[mds].li_fid; rc = lmv_fld_lookup(lmv, &rpid, &mds); if (rc) { @@ -537,7 +537,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp) OBD_ALLOC_PTR(op_data); if (op_data == NULL) RETURN(-ENOMEM); - + lmv_obj_lock(obj); for (i = 0; i < obj->lo_objcount; i++) { @@ -632,10 +632,10 @@ int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, OBD_ALLOC_PTR(sop_data); if (sop_data == NULL) RETURN(-ENOMEM); - + /* save op_data fro repeat case */ *sop_data = *op_data; - + /* * IT_LOOKUP is intended to produce name -> fid resolving (let's call * this lookup below) or to confirm requested resolving is still valid @@ -781,7 +781,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, LASSERT(it != NULL); LASSERT(fid_is_sane(&op_data->fid1)); - + CDEBUG(D_OTHER, "INTENT LOCK '%s' for '%*s' on "DFID"\n", LL_IT2STR(it), op_data->namelen, op_data->name, PFID(&op_data->fid1)); @@ -829,7 +829,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, OBD_ALLOC_PTR(op_data); if (op_data == NULL) RETURN(-ENOMEM); - + /* we have to loop over the subobjects, check validity and update them * from MDSs if needed. it's very useful that we need not to update all * the fields. say, common fields (that are equal on all the subojects @@ -867,7 +867,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, /* it even got the reply refresh attrs * from that reply */ body = lustre_msg_buf(mreq->rq_repmsg, - DLM_REPLY_REC_OFF, + DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); goto update; @@ -891,7 +891,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, rc = md_intent_lock(tgt_exp, op_data, NULL, 0, &it, 0, &req, cb, extra_lock_flags); - + lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle; if (rc > 0 && req == NULL) { /* nice, this slave is valid */ @@ -933,7 +933,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, LASSERT(body); update: - obj->lo_inodes[i].li_size = (MAX_HASH_SIZE/obj->lo_objcount) * + obj->lo_inodes[i].li_size = (MAX_HASH_SIZE/obj->lo_objcount) * (i + 1); CDEBUG(D_OTHER, "fresh: %lu\n", @@ -954,7 +954,7 @@ release_lock: CDEBUG(D_OTHER, "return refreshed attrs: size = %lu\n", (unsigned long)size); - body = lustre_msg_buf((*reqp)->rq_repmsg, + body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body); @@ -967,7 +967,7 @@ release_lock: * no reply and the only attr we can return is size. */ body->valid = OBD_MD_FLSIZE; - + #if 0 rc = lmv_fld_lookup(lmv, &obj->lo_fid, &body->mds); if (rc) diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index ea5c21b..1482e8b 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -147,7 +147,7 @@ struct mdd_object *mdd_object_find(const struct lu_context *ctxt, m = (struct mdd_object *)o; else { o = lu_object_locate(o->lo_header, mdd2lu_dev(d)->ld_type); - m = o ? lu2mdd_obj(o) : NULL; + m = lu2mdd_obj(o); } RETURN(m); } @@ -490,7 +490,7 @@ static int mdd_txn_stop_cb(const struct lu_context *ctx, { struct mdd_device *mdd = cookie; struct obd_device *obd = mdd2obd_dev(mdd); - + return mds_lov_write_objids(obd); } @@ -529,7 +529,7 @@ static struct lu_device *mdd_device_fini(const struct lu_context *ctx, struct lu_device *next = &mdd->mdd_child->dd_lu_dev; dt_txn_callback_del(mdd->mdd_child, &mdd->mdd_txn_cb); - + return next; } @@ -604,7 +604,7 @@ static int mdd_recovery_complete(const struct lu_context *ctxt, obd->obd_type->typ_dt_ops->o_postrecov(obd); /* TODO: orphans handling */ rc = next->ld_ops->ldo_recovery_complete(ctxt, next); - + RETURN(rc); } @@ -845,18 +845,18 @@ int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj, (mode & S_IALLUGO) | (tmp_la->la_mode & ~S_IALLUGO); } - /* For the "Size-on-MDS" setattr update, merge coming attributes with + /* For the "Size-on-MDS" setattr update, merge coming attributes with * the set in the inode. */ if (la->la_valid & LA_SIZE) { if ((la->la_valid & LA_ATIME) && (la->la_atime < tmp_la->la_atime)) la->la_valid &= ~LA_ATIME; - - if ((la->la_valid & LA_CTIME) && + + if ((la->la_valid & LA_CTIME) && (la->la_ctime < tmp_la->la_ctime)) la->la_valid &= ~(LA_MTIME | LA_CTIME); } - + RETURN(rc); } @@ -979,7 +979,7 @@ static int mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj, * 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. + * here let mdt trans stop callback know this. */ if (strncmp(name, MDS_LMV_MD_NAME, strlen(name)) == 0) rc = -ERESTART; @@ -1381,7 +1381,7 @@ static int mdd_is_parent(const struct lu_context *ctxt, /* Do not lookup ".." in root, they do not exist there. */ if (lu_fid_eq(mdo2fid(p1), &mdd->mdd_root_fid)) RETURN(0); - + for(;;) { rc = mdd_parent_fid(ctxt, p1, pfid); if (rc) @@ -1393,7 +1393,7 @@ static int mdd_is_parent(const struct lu_context *ctxt, if (parent) mdd_object_put(ctxt, parent); parent = mdd_object_find(ctxt, mdd, pfid); - + /* cross-ref parent, not supported yet */ if (parent == NULL) { if (pf != NULL) @@ -1422,7 +1422,7 @@ static int mdd_rename_lock(const struct lu_context *ctxt, mdd_write_lock(ctxt, src_pobj); RETURN(0); } - + /* compared the parent child relationship of src_p&tgt_p */ if (lu_fid_eq(&mdd->mdd_root_fid, mdo2fid(src_pobj))){ mdd_lock2(ctxt, src_pobj, tgt_pobj); @@ -1502,7 +1502,6 @@ static int mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj, LASSERT(ma->ma_attr.la_mode & S_IFMT); is_dir = S_ISDIR(ma->ma_attr.la_mode); - if (ma->ma_attr.la_valid & LA_FLAGS && ma->ma_attr.la_flags & (LUSTRE_APPEND_FL | LUSTRE_IMMUTABLE_FL)) RETURN(-EPERM); @@ -1539,7 +1538,7 @@ static int mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj, * so we do index_delete unconditionally and -ENOENT is allowed */ if (rc != 0 && rc != -ENOENT) GOTO(cleanup, rc); - + rc = __mdd_index_insert(ctxt, mdd_tpobj, lf, tname, is_dir, handle); if (rc) GOTO(cleanup, rc); @@ -1626,14 +1625,14 @@ static int mdd_is_subdir(const struct lu_context *ctx, struct md_object *mo, struct mdd_device *mdd = mdo2mdd(mo); int rc; ENTRY; - + if (!S_ISDIR(mdd_object_type(md2mdd_obj(mo)))) RETURN(0); - + rc = mdd_is_parent(ctx, mdd, md2mdd_obj(mo), fid, sfid); if (rc == -EREMOTE) rc = EREMOTE; - + RETURN(rc); } @@ -2186,7 +2185,7 @@ static int mdd_open(const struct lu_context *ctxt, struct md_object *obj, if (mdd_is_immutable(md2mdd_obj(obj))) rc = -EACCES; } - + if (rc == 0) md2mdd_obj(obj)->mod_count ++; diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index 29d973d..0b5fd93 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -68,8 +68,8 @@ void mdt_shrink_reply(struct mdt_thread_info *info, int offset) { struct ptlrpc_request *req = mdt_info_req(info); struct mdt_body *body; - int acl_size = 0; - int md_size = 0; + int acl_size; + int md_size; body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY); LASSERT(body != NULL); @@ -174,7 +174,7 @@ static int mdt_setattr_unpack_rec(struct mdt_thread_info *info) struct mdt_reint_record *rr = &info->mti_rr; struct mdt_rec_setattr *rec; ENTRY; - + rec = req_capsule_client_get(pill, &RMF_REC_SETATTR); if (rec == NULL) RETURN(-EFAULT); @@ -199,10 +199,10 @@ static int mdt_epoch_unpack(struct mdt_thread_info *info) struct req_capsule *pill = &info->mti_pill; ENTRY; - if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT)) + if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT)) info->mti_epoch = req_capsule_client_get(pill, &RMF_MDT_EPOCH); - else - /* it is set to NULL already. + else + /* it is set to NULL already. info->mti_epoch = NULL; */ ; @@ -249,7 +249,7 @@ int mdt_close_unpack(struct mdt_thread_info *info) rc = mdt_epoch_unpack(info); if (rc) RETURN(rc); - + RETURN(mdt_setattr_unpack_rec(info)); } @@ -276,19 +276,19 @@ static int mdt_create_unpack(struct mdt_thread_info *info) attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_ATIME; info->mti_spec.sp_cr_flags = rec->cr_flags; - + rr->rr_name = req_capsule_client_get(pill, &RMF_NAME); if (S_ISDIR(attr->la_mode)) { struct md_create_spec *sp = &info->mti_spec; /* pass parent fid for cross-ref cases */ sp->u.sp_pfid = rr->rr_fid1; if (info->mti_spec.sp_cr_flags & MDS_CREATE_SLAVE_OBJ) { - /* create salve object req, need - * unpack split ea here + /* create salve object req, need + * unpack split ea here */ - req_capsule_extend(pill, + req_capsule_extend(pill, &RQF_MDS_REINT_CREATE_SLAVE); - LASSERT(req_capsule_field_present(pill, + LASSERT(req_capsule_field_present(pill, &RMF_EADATA, RCL_CLIENT)); sp->u.sp_ea.eadata = req_capsule_client_get(pill, &RMF_EADATA); @@ -299,7 +299,7 @@ static int mdt_create_unpack(struct mdt_thread_info *info) } else if (S_ISLNK(attr->la_mode)) { const char *tgt = NULL; req_capsule_extend(pill, &RQF_MDS_REINT_CREATE_SYM); - if (req_capsule_field_present(pill, &RMF_SYMTGT, + if (req_capsule_field_present(pill, &RMF_SYMTGT, RCL_CLIENT)) { tgt = req_capsule_client_get(pill, &RMF_SYMTGT); @@ -307,7 +307,7 @@ static int mdt_create_unpack(struct mdt_thread_info *info) } if (tgt == NULL) result = -EFAULT; - } + } } else result = -EFAULT; RETURN(result); @@ -358,7 +358,7 @@ static int mdt_unlink_unpack(struct mdt_thread_info *info) attr->la_mtime = rec->ul_time; attr->la_mode = rec->ul_mode; - attr->la_valid = LA_UID | LA_GID | LA_CTIME | + attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_MODE; rr->rr_name = req_capsule_client_get(pill, &RMF_NAME); if (rr->rr_name == NULL) diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index ad36a6f..042debd 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -211,7 +211,7 @@ static int mdt_epoch_close(struct mdt_thread_info *info, struct mdt_object *o) /* Epoch ends. Is an Size-on-MDS update needed? */ if (o->mot_flags & MF_SOM_CHANGE) { /* Some previous writer changed the attribute. - * Do not beleive to the current Size-on-MDS + * Do not believe to the current Size-on-MDS * update, re-ask client. */ rc = -EAGAIN; } else if (!(la->la_valid & LA_SIZE) && achange) { diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 1c918dd..62894fd 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -73,7 +73,7 @@ static const struct req_msg_field *mdt_body_only[] = { &RMF_MDT_BODY }; -static const struct req_msg_field *mdt_close_msg[] = { +static const struct req_msg_field *mdt_close_client[] = { &RMF_PTLRPC_BODY, &RMF_MDT_EPOCH, &RMF_REC_SETATTR @@ -633,7 +633,7 @@ EXPORT_SYMBOL(RQF_LDLM_INTENT_UNLINK); const struct req_format RQF_MDS_CLOSE = DEFINE_REQ_FMT0("MDS_CLOSE", - mdt_close_msg, mds_last_unlink_server); + mdt_close_client, mds_last_unlink_server); EXPORT_SYMBOL(RQF_MDS_CLOSE); const struct req_format RQF_MDS_PIN = @@ -643,7 +643,7 @@ EXPORT_SYMBOL(RQF_MDS_PIN); const struct req_format RQF_MDS_DONE_WRITING = DEFINE_REQ_FMT0("MDS_DONE_WRITING", - mdt_close_msg, mdt_body_only); + mdt_close_client, mdt_body_only); EXPORT_SYMBOL(RQF_MDS_DONE_WRITING); const struct req_format RQF_MDS_READPAGE = -- 1.8.3.1