From: tappro Date: Sat, 7 Oct 2006 15:05:31 +0000 (+0000) Subject: use mdc RPC lock to queue the seq/fld requests, except FLD_LOOKUP X-Git-Tag: v1_8_0_110~486^2~657 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=b70556fed4d09d0a7fb1a72b4090b4e8acc54a75;p=fs%2Flustre-release.git use mdc RPC lock to queue the seq/fld requests, except FLD_LOOKUP --- diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 96b2298..2340293 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -45,6 +45,8 @@ #include #include #include +/* mdc RPC locks */ +#include #include "fid_internal.h" static int seq_client_rpc(struct lu_client_seq *seq, @@ -90,7 +92,10 @@ static int seq_client_rpc(struct lu_client_seq *seq, SEQ_CONTROLLER_PORTAL : SEQ_DATA_PORTAL; } + mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); rc = ptlrpc_queue_wait(req); + mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); + if (rc) GOTO(out_req, rc); diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 1933b27..2cfb56d 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "fld_internal.h" static int fld_rrb_hash(struct lu_client_fld *fld, @@ -392,7 +393,11 @@ static int fld_client_rpc(struct obd_export *exp, ptlrpc_req_set_repsize(req, 2, size); req->rq_request_portal = FLD_REQUEST_PORTAL; + if (fld_op != FLD_LOOKUP) + mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); rc = ptlrpc_queue_wait(req); + if (fld_op != FLD_LOOKUP) + mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); if (rc) GOTO(out_req, rc); diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h index 3694e1c..f4d9ef0 100644 --- a/lustre/include/lustre_mdc.h +++ b/lustre/include/lustre_mdc.h @@ -30,6 +30,39 @@ struct obd_export; struct ptlrpc_request; struct obd_device; +struct mdc_rpc_lock { + struct semaphore rpcl_sem; + struct lookup_intent *rpcl_it; +}; + +static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck) +{ + sema_init(&lck->rpcl_sem, 1); + lck->rpcl_it = NULL; +} + +static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck, + struct lookup_intent *it) +{ + ENTRY; + if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) { + down(&lck->rpcl_sem); + LASSERT(lck->rpcl_it == NULL); + lck->rpcl_it = it; + } +} + +static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck, + struct lookup_intent *it) +{ + if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) { + LASSERT(it == lck->rpcl_it); + lck->rpcl_it = NULL; + up(&lck->rpcl_sem); + } + EXIT; +} + /* mdc/mdc_locks.c */ int it_disposition(struct lookup_intent *it, int flag); void it_clear_disposition(struct lookup_intent *it, int flag); diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index d444750..bfcc8e6 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -71,39 +71,6 @@ struct mdc_open_data { struct ptlrpc_request *mod_close_req; }; -struct mdc_rpc_lock { - struct semaphore rpcl_sem; - struct lookup_intent *rpcl_it; -}; - -static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck) -{ - sema_init(&lck->rpcl_sem, 1); - lck->rpcl_it = NULL; -} - -static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck, - struct lookup_intent *it) -{ - ENTRY; - if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) { - down(&lck->rpcl_sem); - LASSERT(lck->rpcl_it == NULL); - lck->rpcl_it = it; - } -} - -static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck, - struct lookup_intent *it) -{ - if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) { - LASSERT(it == lck->rpcl_it); - lck->rpcl_it = NULL; - up(&lck->rpcl_sem); - } - EXIT; -} - static inline int client_is_remote(struct obd_export *exp) { return class_exp2cliimp(exp)->imp_connect_data.ocd_connect_flags &