From: NeilBrown Date: Thu, 20 Dec 2018 04:57:34 +0000 (+1100) Subject: LU-9679 osc: centralize handling of PTLRPCD_SET X-Git-Tag: 2.13.53~177 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=029b2e0eac5399edd4b9e06afdcc237c657b7d51;ds=sidebyside LU-9679 osc: centralize handling of PTLRPCD_SET Various places test if a given rqset is PTLRPCD_SET and call either ptlrpcd_add_req() or ptlrpc_set_add_req() depending on the result. This can be unified by putting the test of PTLRPCD_SET in ptlrpc_set_add_req(), and always calling that function. This results in there being only one place that tests PTLRPCD_SET. Linux-Commit: 6a587cd4c705 ("lustre: centralize handling of PTLRPCD_SET") Reviewed-by: Andreas Dilger Signed-off-by: Mr NeilBrown Change-Id: I879aa9ebb7e841dc2d1240a32d1c5d07e582e0b2 Reviewed-on: https://review.whamcloud.com/37603 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons --- diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 43efca0..fe762ce 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -2116,6 +2116,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); int ptlrpc_set_wait(const struct lu_env *env, struct ptlrpc_request_set *); void ptlrpc_set_destroy(struct ptlrpc_request_set *); void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); +#define PTLRPCD_SET ((struct ptlrpc_request_set *)1) void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool); int ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq); diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index e08d893..b2bc407 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -53,8 +53,6 @@ int osc_extent_release(const struct lu_env *env, struct osc_extent *ext); int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, pgoff_t start, pgoff_t end, bool discard); -extern struct ptlrpc_request_set *PTLRPCD_SET; - void osc_lock_lvb_update(const struct lu_env *env, struct osc_object *osc, struct ldlm_lock *dlmlock, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 3a76729..bd28d27 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -236,10 +236,7 @@ int osc_setattr_async(struct obd_export *exp, struct obdo *oa, sa->sa_upcall = upcall; sa->sa_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); } RETURN(0); @@ -324,10 +321,7 @@ int osc_ladvise_base(struct obd_export *exp, struct obdo *oa, la->la_upcall = upcall; la->la_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); RETURN(0); } @@ -499,10 +493,7 @@ int osc_sync_base(struct osc_object *obj, struct obdo *oa, fa->fa_upcall = upcall; fa->fa_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); RETURN (0); } @@ -2468,8 +2459,6 @@ int osc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req, RETURN(rc); } -struct ptlrpc_request_set *PTLRPCD_SET = (void *)1; - /* When enqueuing asynchronously, locks are not ordered, we can obtain a lock * from the 2nd OSC before a lock from the 1st one. This does not deadlock with * other synchronous requests, however keeping some locks and trying to obtain @@ -2608,10 +2597,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, } req->rq_interpret_reply = osc_enqueue_interpret; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); } else if (intent) { ptlrpc_req_finished(req); } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index ca510a7..4e535f8 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1177,6 +1177,11 @@ EXPORT_SYMBOL(ptlrpc_set_destroy); void ptlrpc_set_add_req(struct ptlrpc_request_set *set, struct ptlrpc_request *req) { + if (set == PTLRPCD_SET) { + ptlrpcd_add_req(req); + return; + } + LASSERT(req->rq_import->imp_state != LUSTRE_IMP_IDLE); LASSERT(list_empty(&req->rq_set_chain));