Whamcloud - gitweb
LU-911 obdclass: new context tags for future use
authorMikhail Pershin <tappro@whamcloud.com>
Thu, 22 Mar 2012 09:53:22 +0000 (13:53 +0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 7 May 2012 19:29:48 +0000 (15:29 -0400)
- 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 <bzzz@whamcloud.com>
Change-Id: Ic41673c91b8d519c95a8740c418070f9e14aa3a6
Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1851
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/ldlm/ldlm_lib.c
lustre/mdt/mdt_handler.c
lustre/obdclass/dt_object.c
lustre/obdclass/lu_object.c
lustre/obdclass/md_local_object.c
lustre/osd-ldiskfs/osd_handler.c
lustre/ptlrpc/target.c

index a37c2d0..5f07f9d 100644 (file)
@@ -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
index 3acbdd7..f5300a8 100644 (file)
@@ -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);
index 63444a1..b87d198 100644 (file)
@@ -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);
index becb572..a7f577b 100644 (file)
@@ -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
 };
index 3993c18..3ef8c40 100644 (file)
@@ -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
 };
index 1d459a7..5b4f349 100644 (file)
@@ -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
 };
index f3ea487..0bf11de 100644 (file)
@@ -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,
 };
 
 /*
index 6f8bccf..47d5939 100644 (file)
@@ -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;