Whamcloud - gitweb
LU-1346 libcfs: cleanup libcfs primitive (linux-prim.h)
[fs/lustre-release.git] / lustre / obdclass / cl_object.c
index 6073df5..662caff 100644 (file)
@@ -547,18 +547,18 @@ struct cl_env {
          */
         cfs_hlist_node_t  ce_node;
 #endif
-        /**
-         * Owner for the current cl_env.
-         *
-         * If LL_TASK_CL_ENV is defined, this point to the owning cfs_current(),
-         * only for debugging purpose ;
-         * Otherwise hash is used, and this is the key for cfs_hash.
-         * Now current thread pid is stored. Note using thread pointer would
-         * lead to unbalanced hash because of its specific allocation locality
-         * and could be varied for different platforms and OSes, even different
-         * OS versions.
-         */
-        void             *ce_owner;
+       /**
+        * Owner for the current cl_env.
+        *
+        * If LL_TASK_CL_ENV is defined, this point to the owning current,
+        * only for debugging purpose ;
+        * Otherwise hash is used, and this is the key for cfs_hash.
+        * Now current thread pid is stored. Note using thread pointer would
+        * lead to unbalanced hash because of its specific allocation locality
+        * and could be varied for different platforms and OSes, even different
+        * OS versions.
+        */
+       void             *ce_owner;
 
         /*
          * Linkage into global list of all client environments. Used for
@@ -649,35 +649,35 @@ static cfs_hash_ops_t cl_env_hops = {
 
 static inline struct cl_env *cl_env_fetch(void)
 {
-        struct cl_env *cle;
+       struct cl_env *cle;
 
-        cle = cfs_hash_lookup(cl_env_hash, (void *) (long) cfs_current()->pid);
-        LASSERT(ergo(cle, cle->ce_magic == &cl_env_init0));
-        return cle;
+       cle = cfs_hash_lookup(cl_env_hash, (void *) (long) current->pid);
+       LASSERT(ergo(cle, cle->ce_magic == &cl_env_init0));
+       return cle;
 }
 
 static inline void cl_env_attach(struct cl_env *cle)
 {
-        if (cle) {
-                int rc;
-
-                LASSERT(cle->ce_owner == NULL);
-                cle->ce_owner = (void *) (long) cfs_current()->pid;
-                rc = cfs_hash_add_unique(cl_env_hash, cle->ce_owner,
-                                         &cle->ce_node);
-                LASSERT(rc == 0);
-        }
+       if (cle) {
+               int rc;
+
+               LASSERT(cle->ce_owner == NULL);
+               cle->ce_owner = (void *) (long) current->pid;
+               rc = cfs_hash_add_unique(cl_env_hash, cle->ce_owner,
+                                        &cle->ce_node);
+               LASSERT(rc == 0);
+       }
 }
 
 static inline void cl_env_do_detach(struct cl_env *cle)
 {
-        void *cookie;
+       void *cookie;
 
-        LASSERT(cle->ce_owner == (void *) (long) cfs_current()->pid);
-        cookie = cfs_hash_del(cl_env_hash, cle->ce_owner,
-                              &cle->ce_node);
-        LASSERT(cookie == cle);
-        cle->ce_owner = NULL;
+       LASSERT(cle->ce_owner == (void *) (long) current->pid);
+       cookie = cfs_hash_del(cl_env_hash, cle->ce_owner,
+                             &cle->ce_node);
+       LASSERT(cookie == cle);
+       cle->ce_owner = NULL;
 }
 
 static int cl_env_store_init(void) {
@@ -702,30 +702,30 @@ static void cl_env_store_fini(void) {
 
 static inline struct cl_env *cl_env_fetch(void)
 {
-        struct cl_env *cle;
+       struct cl_env *cle;
 
-        cle = cfs_current()->LL_TASK_CL_ENV;
-        if (cle && cle->ce_magic != &cl_env_init0)
-                cle = NULL;
-        return cle;
+       cle = current->LL_TASK_CL_ENV;
+       if (cle && cle->ce_magic != &cl_env_init0)
+               cle = NULL;
+       return cle;
 }
 
 static inline void cl_env_attach(struct cl_env *cle)
 {
-        if (cle) {
-                LASSERT(cle->ce_owner == NULL);
-                cle->ce_owner = cfs_current();
-                cle->ce_prev = cfs_current()->LL_TASK_CL_ENV;
-                cfs_current()->LL_TASK_CL_ENV = cle;
-        }
+       if (cle) {
+               LASSERT(cle->ce_owner == NULL);
+               cle->ce_owner = current;
+               cle->ce_prev = current->LL_TASK_CL_ENV;
+               current->LL_TASK_CL_ENV = cle;
+       }
 }
 
 static inline void cl_env_do_detach(struct cl_env *cle)
 {
-        LASSERT(cle->ce_owner == cfs_current());
-        LASSERT(cfs_current()->LL_TASK_CL_ENV == cle);
-        cfs_current()->LL_TASK_CL_ENV = cle->ce_prev;
-        cle->ce_owner = NULL;
+       LASSERT(cle->ce_owner == current);
+       LASSERT(current->LL_TASK_CL_ENV == cle);
+       current->LL_TASK_CL_ENV = cle->ce_prev;
+       cle->ce_owner = NULL;
 }
 
 static int cl_env_store_init(void) { return 0; }