From: huanghua Date: Sat, 29 Apr 2006 03:43:59 +0000 (+0000) Subject: (1) use mdt_lock_hancle instead of lustre_handle. X-Git-Tag: v1_8_0_110~486^2~1905 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=743b50dd32bfff513f3f4678f29f4f30fea5a155;p=fs%2Flustre-release.git (1) use mdt_lock_hancle instead of lustre_handle. (2) more conforming to coding standard. --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index fd81607..bec5650 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -89,9 +89,11 @@ static int mdt_getstatus(struct mdt_thread_info *info, else if (OBD_FAIL_CHECK(OBD_FAIL_MDS_GETSTATUS_PACK)) result = -ENOMEM; else { - info->mti_body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (struct mdt_body)); + info->mti_body = lustre_msg_buf(req->rq_repmsg, 0, + sizeof (struct mdt_body)); result = next->md_ops->mdo_root_get(info->mti_ctxt, - next, &info->mti_body->fid1); + next, + &info->mti_body->fid1); } /* the last_committed and last_xid fields are filled in for all @@ -119,7 +121,8 @@ static int mdt_statfs(struct mdt_thread_info *info, CERROR(LUSTRE_MDT0_NAME": statfs lustre_pack_reply failed\n"); result = -ENOMEM; } else { - osfs = lustre_msg_buf(req->rq_repmsg, 0, sizeof(struct obd_statfs)); + osfs = lustre_msg_buf(req->rq_repmsg, 0, + sizeof(struct obd_statfs)); OBD_ALLOC_PTR(sfs); if(sfs == NULL) RETURN(-ENOMEM); @@ -177,7 +180,8 @@ static int mdt_getattr(struct mdt_thread_info *info, result = next->mo_ops->moo_attr_get(info->mti_ctxt, next, &info->mti_attr); if (result == 0) { - info->mti_body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(struct mdt_body)); + info->mti_body = lustre_msg_buf(req->rq_repmsg, 0, + sizeof(struct mdt_body)); mdt_pack_attr2body(info->mti_body, &info->mti_attr); info->mti_body->fid1 = *mdt_object_fid(info->mti_object); } @@ -254,7 +258,7 @@ static int mdt_readpage(struct mdt_thread_info *info, static int mdt_reint_internal(struct mdt_thread_info *info, struct ptlrpc_request *req, int offset, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { int rc; @@ -299,7 +303,8 @@ static int mdt_reint(struct mdt_thread_info *info, info->mti_rep_buf_size[0] = sizeof(struct mdt_body); info->mti_rep_buf_size[1] = sizeof(struct lov_mds_md); /*FIXME:See mds*/ info->mti_rep_buf_size[2] = sizeof(struct llog_cookie);/*FIXME:See mds*/ - rc = lustre_pack_reply(req, info->mti_rep_buf_nr, info->mti_rep_buf_size, NULL); + rc = lustre_pack_reply(req, info->mti_rep_buf_nr, + info->mti_rep_buf_size, NULL); if (rc) RETURN (rc); rc = mdt_reint_internal(info, req, offset, NULL); @@ -988,7 +993,7 @@ static void fixup_handle_for_resent_req(struct mdt_thread_info *info, int offset, struct ldlm_lock *new_lock, struct ldlm_lock **old_lock, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { struct obd_export *exp = req->rq_export; struct mdt_device * mdt = info->mti_mdt; @@ -1007,10 +1012,10 @@ static void fixup_handle_for_resent_req(struct mdt_thread_info *info, if (lock == new_lock) continue; if (lock->l_remote_handle.cookie == remote_hdl.cookie) { - lockh->cookie = lock->l_handle.h_cookie; + lockh->mlh_lh.cookie = lock->l_handle.h_cookie; LDLM_DEBUG(lock, "restoring lock cookie"); DEBUG_REQ(D_HA, req, "restoring lock cookie "LPX64, - lockh->cookie); + lockh->mlh_lh.cookie); if (old_lock) *old_lock = LDLM_LOCK_GET(lock); l_unlock(&mdt->mdt_namespace->ns_lock); @@ -1044,7 +1049,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock = *lockp; struct ldlm_intent *it; struct ldlm_reply *rep; - struct lustre_handle lockh = { 0 }; + struct mdt_lock_handle lockh = { {0} }; struct ldlm_lock *new_lock = NULL; int getattr_part = MDS_INODELOCK_UPDATE; int offset = MDS_REQ_INTENT_REC_OFF; @@ -1111,7 +1116,8 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, switch ((long)it->opc) { case IT_OPEN: case IT_CREAT|IT_OPEN: - fixup_handle_for_resent_req(info,req, MDS_REQ_INTENT_LOCKREQ_OFF, + fixup_handle_for_resent_req(info, req, + MDS_REQ_INTENT_LOCKREQ_OFF, lock, NULL, &lockh); /* XXX swab here to assert that an mds_open reint * packet is following */ @@ -1133,7 +1139,8 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, getattr_part |= MDS_INODELOCK_LOOKUP; case IT_READDIR: #if 0 - fixup_handle_for_resent_req(info, req, MDS_REQ_INTENT_LOCKREQ_OFF, + fixup_handle_for_resent_req(info, req, + MDS_REQ_INTENT_LOCKREQ_OFF, lock, &new_lock, &lockh); /* INODEBITS_INTEROP: if this lock was converted from a @@ -1176,12 +1183,12 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, * client afterwards. For regular RPCs we want to give the new lock to * the client instead of whatever lock it was about to get. */ if (new_lock == NULL) - new_lock = ldlm_handle2lock(&lockh); + new_lock = ldlm_handle2lock(&lockh.mlh_lh); if (new_lock == NULL && (flags & LDLM_FL_INTENT_ONLY)) RETURN(0); LASSERTF(new_lock != NULL, "op "LPX64" lockh "LPX64"\n", - it->opc, lockh.cookie); + it->opc, lockh.mlh_lh.cookie); /* If we've already given this lock to a client once, then we should * have no readers or writers. Otherwise, we should have one reader diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index d85a524..50f5e3b 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -202,7 +202,7 @@ int mdt_reint_unpack(struct mdt_thread_info *, int); int mdt_reint_rec(struct mdt_thread_info *, - struct lustre_handle *); + struct mdt_lock_handle *); #endif /* __KERNEL__ */ #endif /* _MDT_H */ diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index e28d0fe..9509ef9 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -47,7 +47,7 @@ static int mdt_setattr_unpack(struct mdt_thread_info *info, int offset) { ENTRY; - RETURN(0); + RETURN(-EOPNOTSUPP); } static int mdt_create_unpack(struct mdt_thread_info *info, @@ -59,8 +59,8 @@ static int mdt_create_unpack(struct mdt_thread_info *info, struct mdt_reint_record *rr = &info->mti_rr; ENTRY; - rec = lustre_swab_reqbuf (req, offset, sizeof (*rec), - lustre_swab_mdt_rec_create); + rec = lustre_swab_reqbuf(req, offset, sizeof (*rec), + lustre_swab_mdt_rec_create); if (rec == NULL) RETURN(-EFAULT); @@ -68,7 +68,7 @@ static int mdt_create_unpack(struct mdt_thread_info *info, rr->rr_fid2 = &rec->cr_replayfid; attr->la_mode = rec->cr_mode; - rr->rr_name = lustre_msg_string (req->rq_reqmsg, offset + 1, 0); + rr->rr_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (rr->rr_name == NULL) RETURN(-EFAULT); RETURN(0); @@ -79,7 +79,7 @@ static int mdt_link_unpack(struct mdt_thread_info *info, int offset) { ENTRY; - RETURN(0); + RETURN(-EOPNOTSUPP); } static int mdt_unlink_unpack(struct mdt_thread_info *info, @@ -87,7 +87,7 @@ static int mdt_unlink_unpack(struct mdt_thread_info *info, int offset) { ENTRY; - RETURN(0); + RETURN(-EOPNOTSUPP); } static int mdt_rename_unpack(struct mdt_thread_info *info, @@ -95,7 +95,7 @@ static int mdt_rename_unpack(struct mdt_thread_info *info, int offset) { ENTRY; - RETURN(0); + RETURN(-EOPNOTSUPP); } static int mdt_open_unpack(struct mdt_thread_info *info, @@ -103,7 +103,7 @@ static int mdt_open_unpack(struct mdt_thread_info *info, int offset) { ENTRY; - RETURN(0); + RETURN(-EOPNOTSUPP); } typedef int (*reint_unpacker)(struct mdt_thread_info *info, diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 57a4556..68e0f3f 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -38,7 +38,8 @@ /* object operations */ -static int mdt_md_mkdir(struct mdt_thread_info *info, struct lustre_handle *lockh) +static int mdt_md_mkdir(struct mdt_thread_info *info, + struct mdt_lock_handle *lockh) { struct mdt_device *mdt = info->mti_mdt; struct mdt_object *parent; @@ -51,7 +52,9 @@ static int mdt_md_mkdir(struct mdt_thread_info *info, struct lustre_handle *lock lh->mlh_mode = LCK_PW; parent = mdt_object_find_lock(info->mti_ctxt, - mdt, info->mti_rr.rr_fid1, lh, MDS_INODELOCK_UPDATE); + mdt, info->mti_rr.rr_fid1, + lh, + MDS_INODELOCK_UPDATE); if (IS_ERR(parent)) return PTR_ERR(parent); @@ -73,7 +76,7 @@ static int mdt_md_mkdir(struct mdt_thread_info *info, struct lustre_handle *lock static int mdt_reint_setattr(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { ENTRY; RETURN(-EOPNOTSUPP); @@ -81,7 +84,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, static int mdt_reint_create(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { int rc; ENTRY; @@ -114,14 +117,14 @@ static int mdt_reint_create(struct mdt_thread_info *info, static int mdt_reint_unlink(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { ENTRY; RETURN(-EOPNOTSUPP); } static int mdt_reint_link(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { ENTRY; RETURN(-EOPNOTSUPP); @@ -129,14 +132,14 @@ static int mdt_reint_link(struct mdt_thread_info *info, static int mdt_reint_rename(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { ENTRY; RETURN(-EOPNOTSUPP); } static int mdt_reint_open(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { ENTRY; RETURN(-EOPNOTSUPP); @@ -144,7 +147,7 @@ static int mdt_reint_open(struct mdt_thread_info *info, typedef int (*mdt_reinter)(struct mdt_thread_info *info, - struct lustre_handle *); + struct mdt_lock_handle *); static mdt_reinter reinters[REINT_MAX] = { [REINT_SETATTR] = mdt_reint_setattr, @@ -156,7 +159,7 @@ static mdt_reinter reinters[REINT_MAX] = { }; int mdt_reint_rec(struct mdt_thread_info *info, - struct lustre_handle *lockh) + struct mdt_lock_handle *lockh) { int rc; ENTRY;