Whamcloud - gitweb
LU-3806 obdclass: add LCT_SERVER_SESSION for server session 12/7412/6
authorwang di <di.wang@intel.com>
Wed, 21 Aug 2013 07:04:43 +0000 (00:04 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Oct 2013 01:59:20 +0000 (01:59 +0000)
Add LCT_SERVER_SESSION for server session, and separate the
server session flag from LCT_SESSION, so to avoid allocating
session info for client stack for each server request, if
client and server are on the same node.

Signed-off-by: Wang Di <di.wang@intel.com>
Change-Id: I808c3f58cd7a03ebc166e51fe1e32ea34ae0e3e8
Reviewed-on: http://review.whamcloud.com/7412
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
12 files changed:
lustre/include/lu_object.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_lib.c
lustre/mdt/mdt_coordinator.c
lustre/mdt/mdt_handler.c
lustre/obdclass/capa.c
lustre/obdclass/llog_test.c
lustre/obdclass/lu_ucred.c
lustre/obdclass/obd_mount_server.c
lustre/obdecho/echo_client.c
lustre/ptlrpc/service.c
lustre/target/tgt_main.c

index 549ef33..991d101 100644 (file)
@@ -1014,7 +1014,11 @@ enum lu_context_tag {
         /**
          * Context for local operations
          */
-        LCT_LOCAL = 1 << 7,
+       LCT_LOCAL = 1 << 7,
+       /**
+        * session for server thread
+        **/
+       LCT_SERVER_SESSION = 1 << 8,
         /**
          * Set when at least one of keys, having values in this context has
          * non-NULL lu_context_key::lct_exit() method. This is used to
index 378ab30..fe1eccc 100644 (file)
@@ -565,7 +565,7 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
         if (ldt != NULL) {
                 struct lu_context  session_ctx;
                 struct lu_env env;
-                lu_context_init(&session_ctx, LCT_SESSION);
+                lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION);
                 session_ctx.lc_thread = NULL;
                 lu_context_enter(&session_ctx);
 
index 7e4da6f..961faea 100644 (file)
@@ -1912,7 +1912,7 @@ static int handle_recovery_req(struct ptlrpc_thread *thread,
         if (req->rq_export->exp_disconnected)
                 GOTO(reqcopy_put, rc = 0);
 
-        rc = lu_context_init(&req->rq_recov_session, LCT_SESSION);
+        rc = lu_context_init(&req->rq_recov_session, LCT_SERVER_SESSION);
         if (rc) {
                 CERROR("Failure to initialize session: %d\n", rc);
                 GOTO(reqcopy_put, rc);
index 0071138..b11723d 100644 (file)
@@ -879,7 +879,7 @@ int mdt_hsm_cdt_init(struct mdt_device *mdt)
                RETURN(rc);
 
        /* for mdt_ucred(), lu_ucred stored in lu_ucred_key */
-       rc = lu_context_init(&cdt->cdt_session, LCT_SESSION);
+       rc = lu_context_init(&cdt->cdt_session, LCT_SERVER_SESSION);
        if (rc == 0) {
                lu_context_enter(&cdt->cdt_session);
                cdt->cdt_env.le_ses = &cdt->cdt_session;
index 23a2136..8d4b2b5 100644 (file)
@@ -4830,7 +4830,7 @@ static int mdt_ctxt_add_dirty_flag(struct lu_env *env,
        int rc;
        ENTRY;
 
-       rc = lu_context_init(&ses, LCT_SESSION);
+       rc = lu_context_init(&ses, LCT_SERVER_SESSION);
        if (rc)
                RETURN(rc);
 
@@ -5322,7 +5322,7 @@ static int mdt_ioc_child(struct lu_env *env, struct mdt_device *mdt,
        int rc;
        ENTRY;
 
-       rc = lu_context_init(&ioctl_session, LCT_SESSION);
+        rc = lu_context_init(&ioctl_session, LCT_SERVER_SESSION);
        if (rc)
                RETURN(rc);
        ioctl_session.lc_thread = (struct ptlrpc_thread *)current;
index b81351f..3872d85 100644 (file)
@@ -416,7 +416,7 @@ EXPORT_SYMBOL(_debug_capa);
 LU_KEY_INIT_FINI(lu_capainfo, struct lu_capainfo);
 
 struct lu_context_key lu_capainfo_key = {
-       .lct_tags = LCT_SESSION,
+       .lct_tags = LCT_SERVER_SESSION,
        .lct_init = lu_capainfo_key_init,
        .lct_fini = lu_capainfo_key_fini
 };
index 480333a..b41ab6f 100644 (file)
@@ -1017,7 +1017,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
        if (rc)
                RETURN(rc);
 
-       rc = lu_context_init(&test_session, LCT_SESSION);
+       rc = lu_context_init(&test_session, LCT_SERVER_SESSION);
        if (rc)
                GOTO(cleanup_env, rc);
        test_session.lc_thread = (struct ptlrpc_thread *)current;
index a8be9e8..6c61a5b 100644 (file)
@@ -53,7 +53,7 @@
 LU_KEY_INIT_FINI(lu_ucred, struct lu_ucred);
 
 static struct lu_context_key lu_ucred_key = {
-       .lct_tags = LCT_SESSION,
+       .lct_tags = LCT_SERVER_SESSION,
        .lct_init = lu_ucred_key_init,
        .lct_fini = lu_ucred_key_fini
 };
index 6dbc07a..d028c37 100644 (file)
@@ -514,7 +514,7 @@ static int lustre_lwp_connect(struct obd_device *lwp)
        if (rc != 0)
                RETURN(rc);
 
-       lu_context_init(&session_ctx, LCT_SESSION);
+       lu_context_init(&session_ctx, LCT_SERVER_SESSION);
        session_ctx.lc_thread = NULL;
        lu_context_enter(&session_ctx);
        env.le_ses = &session_ctx;
@@ -1290,7 +1290,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
                if (rc == 0) {
                        struct lu_context  session_ctx;
 
-                       lu_context_init(&session_ctx, LCT_SESSION);
+                       lu_context_init(&session_ctx, LCT_SERVER_SESSION);
                        session_ctx.lc_thread = NULL;
                        lu_context_enter(&session_ctx);
                        env.le_ses = &session_ctx;
index b4344ec..e1ac975 100644 (file)
@@ -2119,7 +2119,7 @@ static void echo_ucred_fini(struct lu_env *env)
 }
 
 #define ECHO_MD_CTX_TAG (LCT_REMEMBER | LCT_MD_THREAD)
-#define ECHO_MD_SES_TAG (LCT_REMEMBER | LCT_SESSION)
+#define ECHO_MD_SES_TAG (LCT_REMEMBER | LCT_SESSION | LCT_SERVER_SESSION)
 static int echo_md_handler(struct echo_device *ed, int command,
                           char *path, int path_len, __u64 id, int count,
                           struct obd_ioctl_data *data)
index 96b3473..15e4802 100644 (file)
@@ -1965,7 +1965,8 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt,
                                    at_get(&svcpt->scp_at_estimate));
         }
 
-       rc = lu_context_init(&request->rq_session, LCT_SESSION | LCT_NOREF);
+       rc = lu_context_init(&request->rq_session, LCT_SERVER_SESSION |
+                                                  LCT_NOREF);
         if (rc) {
                 CERROR("Failure to initialize session: %d\n", rc);
                 goto out_req;
index f7f9b6e..c34be01 100644 (file)
@@ -132,7 +132,7 @@ LU_KEY_INIT_FINI(tgt_ses, struct tgt_session_info);
 
 /* context key: tgt_session_key */
 struct lu_context_key tgt_session_key = {
-       .lct_tags = LCT_SESSION,
+       .lct_tags = LCT_SERVER_SESSION,
        .lct_init = tgt_ses_key_init,
        .lct_fini = tgt_ses_key_fini,
 };