From ad30b8adb2d658659c900b3d1f830bcb976b21f8 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Thu, 22 Mar 2012 13:53:22 +0400 Subject: [PATCH] LU-911 obdclass: new context tags for future use - Add new thread tags: local, mgs and osp - use LCT_LOCAL to avoid extra keys allocation when just local server update is needed. - target_recovery_thread() is capable to serve OFD. Signed-off-by: Alex Zhuravlev Change-Id: Ic41673c91b8d519c95a8740c418070f9e14aa3a6 Signed-off-by: Mikhail Pershin Reviewed-on: http://review.whamcloud.com/1851 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/lu_object.h | 13 ++++++++++++- lustre/ldlm/ldlm_lib.c | 2 +- lustre/mdt/mdt_handler.c | 6 +++--- lustre/obdclass/dt_object.c | 2 +- lustre/obdclass/lu_object.c | 3 ++- lustre/obdclass/md_local_object.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 4 ++-- lustre/ptlrpc/target.c | 4 ++-- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index a37c2d0..5f07f9d 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -999,7 +999,18 @@ enum lu_context_tag { * a client. */ LCT_SESSION = 1 << 4, - + /** + * A per-request data on OSP device + */ + LCT_OSP_THREAD = 1 << 5, + /** + * MGS device thread + */ + LCT_MG_THREAD = 1 << 6, + /** + * Context for local operations + */ + LCT_LOCAL = 1 << 7, /** * 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 diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 3acbdd7..f5300a8 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1879,7 +1879,7 @@ static int target_recovery_thread(void *arg) RETURN(-ENOMEM); } - rc = lu_context_init(&env->le_ctx, LCT_MD_THREAD); + rc = lu_context_init(&env->le_ctx, LCT_MD_THREAD | LCT_DT_THREAD); if (rc) { OBD_FREE_PTR(thread); OBD_FREE_PTR(env); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 63444a1..b87d198 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2190,7 +2190,7 @@ int mdt_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if (lock->l_req_mode == LCK_COS && lock->l_blocking_lock != NULL) { struct lu_env env; - rc = lu_env_init(&env, LCT_MD_THREAD); + rc = lu_env_init(&env, LCT_LOCAL); if (unlikely(rc != 0)) CWARN("lu_env initialization failed with rc = %d," "cannot start asynchronous commit\n", rc); @@ -4023,7 +4023,7 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m) .psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR, .psc_min_threads = mdt_min_threads, .psc_max_threads = mdt_max_threads, - .psc_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD + .psc_ctx_tags = LCT_MD_THREAD }; m->mdt_mdsc_service = @@ -5762,7 +5762,7 @@ void mdt_enable_cos(struct mdt_device *mdt, int val) int rc; mdt->mdt_opts.mo_cos = !!val; - rc = lu_env_init(&env, LCT_MD_THREAD); + rc = lu_env_init(&env, LCT_LOCAL); if (unlikely(rc != 0)) { CWARN("lu_env initialization failed with rc = %d," "cannot sync\n", rc); diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index becb572..a7f577b 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -70,7 +70,7 @@ LU_KEY_INIT(dt_global, struct dt_thread_info); LU_KEY_FINI(dt_global, struct dt_thread_info); static struct lu_context_key dt_key = { - .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD, + .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD | LCT_LOCAL, .lct_init = dt_global_key_init, .lct_fini = dt_global_key_fini }; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 3993c18..3ef8c40 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -372,7 +372,8 @@ LU_KEY_INIT_FINI(lu_global, struct lu_cdebug_data); * lu_global_init(). */ struct lu_context_key lu_global_key = { - .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD|LCT_CL_THREAD, + .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | + LCT_MG_THREAD | LCT_CL_THREAD, .lct_init = lu_global_key_init, .lct_fini = lu_global_key_fini }; diff --git a/lustre/obdclass/md_local_object.c b/lustre/obdclass/md_local_object.c index 1d459a7..5b4f349 100644 --- a/lustre/obdclass/md_local_object.c +++ b/lustre/obdclass/md_local_object.c @@ -91,7 +91,7 @@ LU_KEY_INIT(llod_global, struct llo_thread_info); LU_KEY_FINI(llod_global, struct llo_thread_info); static struct lu_context_key llod_key = { - .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD, + .lct_tags = LCT_MD_THREAD, .lct_init = llod_global_key_init, .lct_fini = llod_global_key_fini }; diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index f3ea487..0bf11de 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -3977,7 +3977,7 @@ static void osd_key_exit(const struct lu_context *ctx, LU_TYPE_INIT_FINI(osd, &osd_key); struct lu_context_key osd_key = { - .lct_tags = LCT_DT_THREAD | LCT_MD_THREAD, + .lct_tags = LCT_DT_THREAD | LCT_MD_THREAD | LCT_MG_THREAD | LCT_LOCAL, .lct_init = osd_key_init, .lct_fini = osd_key_fini, .lct_exit = osd_key_exit @@ -4212,7 +4212,7 @@ static struct lu_device_type osd_device_type = { .ldt_tags = LU_DEVICE_DT, .ldt_name = LUSTRE_OSD_NAME, .ldt_ops = &osd_device_type_ops, - .ldt_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD + .ldt_ctx_tags = LCT_LOCAL, }; /* diff --git a/lustre/ptlrpc/target.c b/lustre/ptlrpc/target.c index 6f8bccf..47d5939 100644 --- a/lustre/ptlrpc/target.c +++ b/lustre/ptlrpc/target.c @@ -163,7 +163,7 @@ static int lut_last_rcvd_write(const struct lu_env *env, struct lu_target *lut, if (rc) goto stop; - rc = dt_trans_start(env, lut->lut_bottom, th); + rc = dt_trans_start_local(env, lut->lut_bottom, th); if (rc) goto stop; @@ -304,7 +304,7 @@ void lut_boot_epoch_update(struct lu_target *lut) if (lut->lut_bottom == NULL) return obt_boot_epoch_update(lut); - rc = lu_env_init(&env, LCT_DT_THREAD); + rc = lu_env_init(&env, LCT_LOCAL); if (rc) { CERROR("Can't initialize environment rc=%d\n", rc); return; -- 1.8.3.1