From: nikita Date: Fri, 4 Aug 2006 14:00:42 +0000 (+0000) Subject: mdt: do not use mdt_thread_info for implicit parameter passing, add some consts X-Git-Tag: v1_8_0_110~486^2~1275 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=08820ae2c38e16fdb6f9577309c5b99457542d1e;p=fs%2Flustre-release.git mdt: do not use mdt_thread_info for implicit parameter passing, add some consts --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index bbf9c9f..6160087 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -168,8 +168,7 @@ static int mdt_statfs(struct mdt_thread_info *info) RETURN(result); } -void mdt_pack_attr2body(struct mdt_body *b, - struct lu_attr *attr, +void mdt_pack_attr2body(struct mdt_body *b, const struct lu_attr *attr, const struct lu_fid *fid) { b->valid |= OBD_MD_FLCTIME | OBD_MD_FLUID | diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 0391ffb..8825ce1 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -314,7 +314,7 @@ void mdt_object_unlock_put(struct mdt_thread_info *, int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op); int mdt_reint_rec(struct mdt_thread_info *); -void mdt_pack_attr2body(struct mdt_body *b, struct lu_attr *attr, +void mdt_pack_attr2body(struct mdt_body *b, const struct lu_attr *attr, const struct lu_fid *fid); int mdt_getxattr(struct mdt_thread_info *info); @@ -361,7 +361,8 @@ 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); -int mdt_handle_last_unlink(struct mdt_thread_info *, struct mdt_object *); +int mdt_handle_last_unlink(struct mdt_thread_info *, struct mdt_object *, + const struct md_attr *); void mdt_dump_lmm(int level, struct lov_mds_md *lmm); diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index d16b897..914c8e9 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -77,11 +77,11 @@ void mdt_shrink_reply(struct mdt_thread_info *info) 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) * + cookie_size = le32_to_cpu(lmm->lmm_stripe_count) * sizeof(struct llog_cookie); } - CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", + CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", md_size, cookie_size); lustre_shrink_reply(req, 1, md_size, 1); @@ -91,12 +91,11 @@ void mdt_shrink_reply(struct mdt_thread_info *info) /* if object is dying, pack the lov/llog data, * parameter info->mti_attr should be valid at this point! */ -int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo) +int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo, + const struct md_attr *ma) { - struct mdt_body *repbody; - struct md_attr *ma = &info->mti_attr; - struct lu_attr *la = &ma->ma_attr; - int rc = 0; + struct mdt_body *repbody; + const struct lu_attr *la = &ma->ma_attr; ENTRY; @@ -109,7 +108,7 @@ int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo) PFID3(mdt_object_fid(mo))); CDEBUG(D_INODE, "ma_valid = "LPX64"\n", ma->ma_valid); - repbody = req_capsule_server_get(&info->mti_pill, + repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY); if (ma->ma_valid & MA_INODE) mdt_pack_attr2body(repbody, la, mdt_object_fid(mo)); @@ -118,12 +117,12 @@ int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo) repbody->eadatasize = ma->ma_lmm_size; repbody->valid |= OBD_MD_FLEASIZE; } - - if (ma->ma_cookie_size && ma->ma_valid & MA_COOKIE) + + if (ma->ma_cookie_size && ma->ma_valid & MA_COOKIE) repbody->valid |= OBD_MD_FLCOOKIE; } - RETURN(rc); + RETURN(0); } /* unpacking */ diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index f1a1463..1166036 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -196,11 +196,11 @@ static int mdt_reint_create(struct mdt_thread_info *info) { int rc; ENTRY; - + rc = req_capsule_pack(&info->mti_pill); if (rc) RETURN(rc); - + switch (info->mti_attr.ma_attr.la_mode & S_IFMT) { case S_IFREG: case S_IFDIR:{ @@ -244,9 +244,9 @@ static int mdt_reint_unlink(struct mdt_thread_info *info) DEBUG_REQ(D_INODE, req, "unlink "DFID3"/%s\n", PFID3(rr->rr_fid1), rr->rr_name); /*pack the reply*/ - req_capsule_set_size(&info->mti_pill, &RMF_MDT_MD, RCL_SERVER, + req_capsule_set_size(&info->mti_pill, &RMF_MDT_MD, RCL_SERVER, info->mti_mdt->mdt_max_mdsize); - req_capsule_set_size(&info->mti_pill, &RMF_LOGCOOKIES, RCL_SERVER, + req_capsule_set_size(&info->mti_pill, &RMF_LOGCOOKIES, RCL_SERVER, info->mti_mdt->mdt_max_cookiesize); rc = req_capsule_pack(&info->mti_pill); if (rc) @@ -282,7 +282,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info) /*step 3: do some checking ...*/ - + /* step 4: delete it */ /* cmm will take care if child is local or remote */ @@ -290,11 +290,11 @@ static int mdt_reint_unlink(struct mdt_thread_info *info) ma->ma_lmm_size = req_capsule_get_size(&info->mti_pill, &RMF_MDT_MD, RCL_SERVER); - ma->ma_cookie = req_capsule_server_get(&info->mti_pill, + ma->ma_cookie = req_capsule_server_get(&info->mti_pill, &RMF_LOGCOOKIES); ma->ma_cookie_size = req_capsule_get_size(&info->mti_pill, &RMF_LOGCOOKIES, RCL_SERVER); - + if (!ma->ma_lmm || !ma->ma_cookie) GOTO(out_unlock_parent, rc = -EINVAL); @@ -303,7 +303,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info) if (rc) GOTO(out_unlock_child, rc); - rc = mdt_handle_last_unlink(info, mc); + rc = mdt_handle_last_unlink(info, mc, ma); GOTO(out_unlock_child, rc); out_unlock_child: @@ -512,9 +512,9 @@ static int mdt_reint_rename(struct mdt_thread_info *info) if (rc == 0) { /* the new_fid should have been filled at this moment*/ if (lu_fid_eq(old_fid, new_fid)) - GOTO(out_unlock_old, rc); - - if (lu_fid_eq(new_fid, rr->rr_fid1) || + GOTO(out_unlock_old, rc); + + if (lu_fid_eq(new_fid, rr->rr_fid1) || lu_fid_eq(new_fid, rr->rr_fid2)) GOTO(out_unlock_old, rc = -EINVAL);