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:
/**
* Context for local operations
*/
/**
* Context for local operations
*/
+ 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
/**
* 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
if (ldt != NULL) {
struct lu_context session_ctx;
struct lu_env env;
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);
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
if (req->rq_export->exp_disconnected)
GOTO(reqcopy_put, rc = 0);
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);
if (rc) {
CERROR("Failure to initialize session: %d\n", rc);
GOTO(reqcopy_put, rc);
RETURN(rc);
/* for mdt_ucred(), lu_ucred stored in lu_ucred_key */
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;
if (rc == 0) {
lu_context_enter(&cdt->cdt_session);
cdt->cdt_env.le_ses = &cdt->cdt_session;
- rc = lu_context_init(&ses, LCT_SESSION);
+ rc = lu_context_init(&ses, LCT_SERVER_SESSION);
- 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;
if (rc)
RETURN(rc);
ioctl_session.lc_thread = (struct ptlrpc_thread *)current;
LU_KEY_INIT_FINI(lu_capainfo, struct lu_capainfo);
struct lu_context_key lu_capainfo_key = {
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
};
.lct_init = lu_capainfo_key_init,
.lct_fini = lu_capainfo_key_fini
};
- 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;
if (rc)
GOTO(cleanup_env, rc);
test_session.lc_thread = (struct ptlrpc_thread *)current;
LU_KEY_INIT_FINI(lu_ucred, struct lu_ucred);
static struct lu_context_key lu_ucred_key = {
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
};
.lct_init = lu_ucred_key_init,
.lct_fini = lu_ucred_key_fini
};
- 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;
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
env.le_ses = &session_ctx;
if (rc == 0) {
struct lu_context session_ctx;
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;
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
env.le_ses = &session_ctx;
}
#define ECHO_MD_CTX_TAG (LCT_REMEMBER | LCT_MD_THREAD)
}
#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)
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)
at_get(&svcpt->scp_at_estimate));
}
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;
if (rc) {
CERROR("Failure to initialize session: %d\n", rc);
goto out_req;
/* context key: tgt_session_key */
struct lu_context_key tgt_session_key = {
/* 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,
};
.lct_init = tgt_ses_key_init,
.lct_fini = tgt_ses_key_fini,
};