From: huanghua Date: Wed, 16 Aug 2006 07:13:10 +0000 (+0000) Subject: (1) mdt shrink reply; X-Git-Tag: v1_8_0_110~486^2~1164 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=52db0eae6ea0d6927aa36b07db908d9df3f6afde;p=fs%2Flustre-release.git (1) mdt shrink reply; (2) restore sanity 31 and 48 test --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index d79581d..55cd758 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -208,7 +208,7 @@ static inline int mdt_body_has_lov(const struct lu_attr *la, } static int mdt_getattr_internal(struct mdt_thread_info *info, - struct mdt_object *o, int offset) + struct mdt_object *o) { struct md_object *next = mdt_object_child(o); const struct mdt_body *reqbody = info->mti_body; @@ -239,7 +239,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, /* This object is located on remote node.*/ repbody->fid1 = *mdt_object_fid(o); repbody->valid |= OBD_MD_FLID; - GOTO(shrink, rc = 0); + RETURN(rc); } else if (rc){ CERROR("getattr error for "DFID": %d\n", PFID(mdt_object_fid(o)), rc); @@ -311,18 +311,6 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, } #endif -shrink: - /* FIXME: determine the offset of MDT_MD. but it does not work */ -/* - if (req_capsule_has_field(pill, &RMF_DLM_REP)) { - offset = 2; - } else - offset = 1; -*/ - lustre_shrink_reply(req, offset, repbody->eadatasize, 1); - if (repbody->eadatasize) - offset ++; - lustre_shrink_reply(req, offset, repbody->aclsize, 0); RETURN(rc); } @@ -346,8 +334,9 @@ static int mdt_getattr(struct mdt_thread_info *info) if (MDT_FAIL_CHECK(OBD_FAIL_MDS_GETATTR_PACK)) { result = -ENOMEM; } else { - result = mdt_getattr_internal(info, info->mti_object, 1); + result = mdt_getattr_internal(info, info->mti_object); } + mdt_shrink_reply(info, 1); RETURN(result); } @@ -393,8 +382,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, result = mdt_object_lock(info, child, lhc, child_bits); if (result == 0) { /* finally, we can get attr for child. */ - result = mdt_getattr_internal(info, child, - ldlm_rep ? 2 : 1); + result = mdt_getattr_internal(info, child); if (result != 0) mdt_object_unlock(info, child, lhc, 1); } @@ -427,8 +415,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, GOTO(out_parent, result = PTR_ERR(child)); /* finally, we can get attr for child. */ - result = mdt_getattr_internal(info, child, - ldlm_rep ? 2 : 1); + result = mdt_getattr_internal(info, child); if (result != 0) mdt_object_unlock(info, child, lhc, 1); else { @@ -477,6 +464,7 @@ static int mdt_getattr_name(struct mdt_thread_info *info) ldlm_lock_decref(&lhc->mlh_lh, lhc->mlh_mode); lhc->mlh_lh.cookie = 0; } + mdt_shrink_reply(info, 1); RETURN(rc); } @@ -1555,6 +1543,7 @@ static int mdt_intent_getattr(enum mdt_it_code opcode, ldlm_rep->lock_policy_res2 = mdt_getattr_name_lock(info, lhc, child_bits, ldlm_rep); + mdt_shrink_reply(info, 2); if (intent_disposition(ldlm_rep, DISP_LOOKUP_NEG)) ldlm_rep->lock_policy_res2 = 0; @@ -2694,8 +2683,7 @@ static struct obd_ops mdt_obd_device_ops = { .o_destroy_export = mdt_destroy_export, /* By Huang Hua*/ }; -static struct lu_device *mdt_device_free(const struct lu_context *ctx, - struct lu_device *d) +static void mdt_device_free(const struct lu_context *ctx, struct lu_device *d) { struct mdt_device *m = mdt_dev(d); diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index b416f47..a7742a3 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -375,7 +375,7 @@ void mdt_mfd_close(const struct lu_context *ctxt, struct mdt_device *mdt, int mdt_close(struct mdt_thread_info *info); int mdt_done_writing(struct mdt_thread_info *info); -void mdt_shrink_reply(struct mdt_thread_info *info); +void mdt_shrink_reply(struct mdt_thread_info *info, int offset); int mdt_handle_last_unlink(struct mdt_thread_info *, struct mdt_object *, const struct md_attr *); diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index c19b3d7..e860ad9 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -64,31 +64,24 @@ void mdt_dump_lmm(int level, struct lov_mds_md *lmm) } } -void mdt_shrink_reply(struct mdt_thread_info *info) +void mdt_shrink_reply(struct mdt_thread_info *info, int offset) { struct ptlrpc_request *req = mdt_info_req(info); struct mdt_body *body; - struct lov_mds_md *lmm; - int cookie_size = 0; + int acl_size = 0; int md_size = 0; body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY); + LASSERT(body != NULL); - if (body && body->valid & OBD_MD_FLEASIZE) { - md_size = body->eadatasize; - } - if (body && body->valid & OBD_MD_FLCOOKIE) { - LASSERT(body->valid & OBD_MD_FLEASIZE); - lmm = req_capsule_server_get(&info->mti_pill, &RMF_MDT_MD); - cookie_size = le32_to_cpu(lmm->lmm_stripe_count) * - sizeof(struct llog_cookie); - } + md_size = body->eadatasize; + acl_size = body->aclsize; CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", - md_size, cookie_size); + md_size, acl_size); - lustre_shrink_reply(req, 1, md_size, 1); - lustre_shrink_reply(req, md_size? 2:1, cookie_size, 0); + lustre_shrink_reply(req, offset, md_size, 1); + lustre_shrink_reply(req, md_size? offset + 1: offset, acl_size, 0); } diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 5a494f4..d4e6946 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -250,9 +250,7 @@ static int mdt_mfd_open(struct mdt_thread_info *info, } /*FIXME: should determine the offset dynamicly, *did not get ACL before shrink*/ - lustre_shrink_reply(req, 2, repbody->eadatasize, 1); - lustre_shrink_reply(req, repbody->eadatasize ? 3 : 2, repbody->aclsize, - 0); + mdt_shrink_reply(info, 2); ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP); intent_set_disposition(ldlm_rep, DISP_OPEN_OPEN); @@ -502,6 +500,7 @@ int mdt_close(struct mdt_thread_info *info) struct mdt_file_data *mfd; struct mdt_object *o; struct md_attr *ma = &info->mti_attr; + struct mdt_body *repbody; int rc; ENTRY; @@ -513,6 +512,10 @@ int mdt_close(struct mdt_thread_info *info) if (rc) RETURN(rc); + repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY); + repbody->eadatasize = 0; + repbody->aclsize = 0; + med = &mdt_info_req(info)->rq_export->exp_mdt_data; spin_lock(&med->med_open_lock); @@ -546,7 +549,7 @@ int mdt_close(struct mdt_thread_info *info) /* release reference on this object. */ mdt_object_put(info->mti_ctxt, o); } - mdt_shrink_reply(info); + mdt_shrink_reply(info, 1); RETURN(rc); } diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 09d6bbc..de94623 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -309,7 +309,7 @@ out_unlock_child: mdt_object_unlock_put(info, mc, lhc, rc); out_unlock_parent: mdt_object_unlock_put(info, mp, lhp, rc); - mdt_shrink_reply(info); + mdt_shrink_reply(info, 1); return rc; } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e7e217e..7ffc69c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -18,7 +18,7 @@ ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"42a 42b 42c 42d 45 68"} EXCEPT="$EXCEPT 24o" # Tests that always fail with mountconf -- FIXME # 48a moving the working dir succeeds -EXCEPT="$EXCEPT 48 31" +EXCEPT="$EXCEPT 76 99" case `uname -r` in 2.4*) FSTYPE=${FSTYPE:-ext3}; ALWAYS_EXCEPT="$ALWAYS_EXCEPT 76" ;;