From: Nikitas Angelinas Date: Mon, 15 Apr 2013 12:17:15 +0000 (+0100) Subject: LU-3172 ost: call lustre_msg_get_opc() once inside ost_handle() X-Git-Tag: 2.3.65~16 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=68d9f80ea8145fabc845cc875046de4762894a7a;p=fs%2Flustre-release.git LU-3172 ost: call lustre_msg_get_opc() once inside ost_handle() lustre_msg_get_opc() is called a few times inside ost_handle(); there is no real benefit from this, and we can just make one call when entering the function. There may be other occurrences in the source where this applies, apart from ost_handle(), but we can at least make this change here for now, as this is a frequently-called function. Signed-off-by: Nikitas Angelinas Change-Id: I7a8badc30ca31cb6826463ae5390cef96dec345f Xyratex-bug-id: MRP-698 Reviewed-by: Andrew Perepechko Reviewed-by: Vitaly Fertman Reviewed-on: http://review.whamcloud.com/6055 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 853d626..3f7e207 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -2153,35 +2153,35 @@ static int ost_io_hpreq_handler(struct ptlrpc_request *req) /* TODO: handle requests in a similar way as MDT: see mdt_handle_common() */ int ost_handle(struct ptlrpc_request *req) { - struct obd_trans_info trans_info = { 0, }; - struct obd_trans_info *oti = &trans_info; - int should_process, fail = OBD_FAIL_OST_ALL_REPLY_NET, rc = 0; - struct obd_device *obd = NULL; - ENTRY; + struct obd_trans_info trans_info = { 0, }; + struct obd_trans_info *oti = &trans_info; + int should_process, fail = OBD_FAIL_OST_ALL_REPLY_NET, rc = 0; + struct obd_device *obd = NULL; + __u32 opc = lustre_msg_get_opc(req->rq_reqmsg); + ENTRY; - /* OST module is kept between remounts, but the last reference - * to specific module (say, osd or ofd) kills all related keys - * from the environment. so we have to refill it until the root - * cause is fixed properly */ - lu_env_refill(req->rq_svc_thread->t_env); + /* OST module is kept between remounts, but the last reference + * to specific module (say, osd or ofd) kills all related keys + * from the environment. so we have to refill it until the root + * cause is fixed properly */ + lu_env_refill(req->rq_svc_thread->t_env); - LASSERT(current->journal_info == NULL); + LASSERT(current->journal_info == NULL); - /* primordial rpcs don't affect server recovery */ - switch (lustre_msg_get_opc(req->rq_reqmsg)) { - case SEC_CTX_INIT: - case SEC_CTX_INIT_CONT: - case SEC_CTX_FINI: - GOTO(out, rc = 0); - } + /* primordial rpcs don't affect server recovery */ + switch (opc) { + case SEC_CTX_INIT: + case SEC_CTX_INIT_CONT: + case SEC_CTX_FINI: + GOTO(out, rc = 0); + } - req_capsule_init(&req->rq_pill, req, RCL_SERVER); + req_capsule_init(&req->rq_pill, req, RCL_SERVER); - if (lustre_msg_get_opc(req->rq_reqmsg) != OST_CONNECT) { - if (!class_connected_export(req->rq_export)) { - CDEBUG(D_HA,"operation %d on unconnected OST from %s\n", - lustre_msg_get_opc(req->rq_reqmsg), - libcfs_id2str(req->rq_peer)); + if (opc != OST_CONNECT) { + if (!class_connected_export(req->rq_export)) { + CDEBUG(D_HA,"operation %d on unconnected OST from %s\n", + opc, libcfs_id2str(req->rq_peer)); req->rq_status = -ENOTCONN; GOTO(out, rc = -ENOTCONN); } @@ -2212,7 +2212,7 @@ int ost_handle(struct ptlrpc_request *req) (exp_connect_flags(req->rq_export) & OBD_CONNECT_JOBSTATS)) oti->oti_jobid = lustre_msg_get_jobid(req->rq_reqmsg); - switch (lustre_msg_get_opc(req->rq_reqmsg)) { + switch (opc) { case OST_CONNECT: { CDEBUG(D_INODE, "connect\n"); req_capsule_set(&req->rq_pill, &RQF_OST_CONNECT); @@ -2414,8 +2414,7 @@ int ost_handle(struct ptlrpc_request *req) CERROR("callbacks should not happen on OST\n"); /* fall through */ default: - CERROR("Unexpected opcode %d\n", - lustre_msg_get_opc(req->rq_reqmsg)); + CERROR("Unexpected opcode %d\n", opc); req->rq_status = -ENOTSUPP; rc = ptlrpc_error(req); RETURN(rc); @@ -2425,7 +2424,7 @@ int ost_handle(struct ptlrpc_request *req) EXIT; /* If we're DISCONNECTing, the export_data is already freed */ - if (!rc && lustre_msg_get_opc(req->rq_reqmsg) != OST_DISCONNECT) + if (!rc && opc != OST_DISCONNECT) target_committed_to_req(req); out: