*/
 
 /**
- * An `emergency' environment used by ccc_inode_fini() when cl_env_get()
- * fails. Access to this environment is serialized by ccc_inode_fini_guard
+ * An `emergency' environment used by cl_inode_fini() when cl_env_get()
+ * fails. Access to this environment is serialized by cl_inode_fini_guard
  * mutex.
  */
-static struct lu_env *ccc_inode_fini_env;
+struct lu_env *cl_inode_fini_env;
+int cl_inode_fini_refcheck;
 
 /**
  * A mutex serializing calls to slp_inode_fini() under extreme memory
  * pressure, when environments cannot be allocated.
  */
-static DEFINE_MUTEX(ccc_inode_fini_guard);
-static int dummy_refcheck;
-
-int ccc_global_init(struct lu_device_type *device_type)
-{
-       int result;
-
-       result = lu_device_type_init(device_type);
-       if (result)
-               return result;
-
-       ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck,
-                                         LCT_REMEMBER | LCT_NOREF);
-       if (IS_ERR(ccc_inode_fini_env)) {
-               result = PTR_ERR(ccc_inode_fini_env);
-               goto out_device;
-       }
-
-       ccc_inode_fini_env->le_ctx.lc_cookie = 0x4;
-       return 0;
-out_device:
-       lu_device_type_fini(device_type);
-       return result;
-}
-
-void ccc_global_fini(struct lu_device_type *device_type)
-{
-       if (ccc_inode_fini_env) {
-               cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
-               ccc_inode_fini_env = NULL;
-       }
-       lu_device_type_fini(device_type);
-}
+static DEFINE_MUTEX(cl_inode_fini_guard);
 
 int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
 {
                env = cl_env_get(&refcheck);
                emergency = IS_ERR(env);
                if (emergency) {
-                       mutex_lock(&ccc_inode_fini_guard);
-                       LASSERT(ccc_inode_fini_env);
-                       cl_env_implant(ccc_inode_fini_env, &refcheck);
-                       env = ccc_inode_fini_env;
+                       mutex_lock(&cl_inode_fini_guard);
+                       LASSERT(cl_inode_fini_env);
+                       cl_env_implant(cl_inode_fini_env, &refcheck);
+                       env = cl_inode_fini_env;
                }
                /*
                 * cl_object cache is a slave to inode cache (which, in turn
                cl_object_put_last(env, clob);
                lli->lli_clob = NULL;
                if (emergency) {
-                       cl_env_unplant(ccc_inode_fini_env, &refcheck);
-                       mutex_unlock(&ccc_inode_fini_guard);
+                       cl_env_unplant(cl_inode_fini_env, &refcheck);
+                       mutex_unlock(&cl_inode_fini_guard);
                } else {
                        cl_env_put(env, &refcheck);
                }
 
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
 int lustre_check_remote_perm(struct inode *inode, int mask);
 
-/* llite/llite_cl.c */
-extern struct lu_device_type vvp_device_type;
-
 /**
  * Common IO arguments for various VFS I/O interfaces.
  */
 int ll_page_sync_io(const struct lu_env *env, struct cl_io *io,
                    struct cl_page *page, enum cl_req_type crt);
 
+/* lcommon_cl.c */
+extern struct lu_env *cl_inode_fini_env;
+extern int cl_inode_fini_refcheck;
+
 #endif /* LLITE_INTERNAL_H */
 
        if (rc != 0)
                goto out_sysfs;
 
+       cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
+                                        LCT_REMEMBER | LCT_NOREF);
+       if (IS_ERR(cl_inode_fini_env)) {
+               rc = PTR_ERR(cl_inode_fini_env);
+               goto out_vvp;
+       }
+
+       cl_inode_fini_env->le_ctx.lc_cookie = 0x4;
+
        rc = ll_xattr_init();
        if (rc != 0)
-               goto out_vvp;
+               goto out_inode_fini_env;
 
        lustre_register_client_fill_super(ll_fill_super);
        lustre_register_kill_super_cb(ll_kill_super);
 
        return 0;
 
+out_inode_fini_env:
+       cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 out_vvp:
        vvp_global_fini();
 out_sysfs:
        kset_unregister(llite_kset);
 
        ll_xattr_fini();
+       cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
        vvp_global_fini();
 
        kmem_cache_destroy(ll_inode_cachep);
 
  */
 int vvp_global_init(void)
 {
-       int result;
+       int rc;
 
-       result = lu_kmem_init(vvp_caches);
-       if (result == 0) {
-               result = ccc_global_init(&vvp_device_type);
-               if (result != 0)
-                       lu_kmem_fini(vvp_caches);
-       }
-       return result;
+       rc = lu_kmem_init(vvp_caches);
+       if (rc != 0)
+               return rc;
+
+       rc = lu_device_type_init(&vvp_device_type);
+       if (rc != 0)
+               goto out_kmem;
+
+       return 0;
+
+out_kmem:
+       lu_kmem_fini(vvp_caches);
+
+       return rc;
 }
 
 void vvp_global_fini(void)
 {
-       ccc_global_fini(&vvp_device_type);
+       lu_device_type_fini(&vvp_device_type);
        lu_kmem_fini(vvp_caches);
 }