- rc = ll_init_inodecache();
- if (rc)
- return -ENOMEM;
- ll_file_data_slab = cfs_mem_cache_create("ll_file_data",
- sizeof(struct ll_file_data), 0,
- CFS_SLAB_HWCACHE_ALIGN);
- if (ll_file_data_slab == NULL) {
- ll_destroy_inodecache();
- return -ENOMEM;
- }
-
- ll_remote_perm_cachep = cfs_mem_cache_create("ll_remote_perm_cache",
- sizeof(struct ll_remote_perm),
- 0, 0);
- if (ll_remote_perm_cachep == NULL) {
- cfs_mem_cache_destroy(ll_file_data_slab);
- ll_file_data_slab = NULL;
- ll_destroy_inodecache();
- return -ENOMEM;
- }
-
- ll_rmtperm_hash_cachep = cfs_mem_cache_create("ll_rmtperm_hash_cache",
- REMOTE_PERM_HASHSIZE *
- sizeof(cfs_list_t),
- 0, 0);
- if (ll_rmtperm_hash_cachep == NULL) {
- cfs_mem_cache_destroy(ll_remote_perm_cachep);
- ll_remote_perm_cachep = NULL;
- cfs_mem_cache_destroy(ll_file_data_slab);
- ll_file_data_slab = NULL;
- ll_destroy_inodecache();
- return -ENOMEM;
- }
-
- proc_lustre_fs_root = proc_lustre_root ?
- lprocfs_register("llite", proc_lustre_root, NULL, NULL) : NULL;
-
- lustre_register_client_fill_super(ll_fill_super);
- lustre_register_kill_super_cb(ll_kill_super);
-
- lustre_register_client_process_config(ll_process_config);
-
- cfs_get_random_bytes(seed, sizeof(seed));
-
- /* Nodes with small feet have little entropy
- * the NID for this node gives the most entropy in the low bits */
- for (i=0; ; i++) {
- if (LNetGetId(i, &lnet_id) == -ENOENT) {
- break;
- }
- if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) {
- seed[0] ^= LNET_NIDADDR(lnet_id.nid);
- }
- }
-
- cfs_gettimeofday(&tv);
- cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
-
- init_timer(&ll_capa_timer);
- ll_capa_timer.function = ll_capa_timer_callback;
- rc = ll_capa_thread_start();
- /*
- * XXX normal cleanup is needed here.
- */
- if (rc == 0)
- rc = vvp_global_init();
-
- return rc;
+ ll_inode_cachep = kmem_cache_create("lustre_inode_cache",
+ sizeof(struct ll_inode_info),
+ 0, lustre_inode_cache_flags, NULL);
+ if (ll_inode_cachep == NULL)
+ GOTO(out_cache, rc = -ENOMEM);
+
+ ll_file_data_slab = kmem_cache_create("ll_file_data",
+ sizeof(struct ll_file_data), 0,
+ SLAB_HWCACHE_ALIGN, NULL);
+ if (ll_file_data_slab == NULL)
+ GOTO(out_cache, rc = -ENOMEM);
+
+ pcc_inode_slab = kmem_cache_create("ll_pcc_inode",
+ sizeof(struct pcc_inode), 0,
+ SLAB_HWCACHE_ALIGN, NULL);
+ if (pcc_inode_slab == NULL)
+ GOTO(out_cache, rc = -ENOMEM);
+
+ rc = llite_tunables_register();
+ if (rc)
+ GOTO(out_cache, rc);
+
+ /* Nodes with small feet have little entropy. The NID for this
+ * node gives the most entropy in the low bits. */
+ for (i = 0;; i++) {
+ if (LNetGetId(i, &lnet_id) == -ENOENT)
+ break;
+
+ add_device_randomness(&lnet_id.nid, sizeof(lnet_id.nid));
+ }
+
+ rc = vvp_global_init();
+ if (rc != 0)
+ GOTO(out_tunables, rc);
+
+ cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
+ LCT_REMEMBER | LCT_NOREF);
+ if (IS_ERR(cl_inode_fini_env))
+ GOTO(out_vvp, rc = PTR_ERR(cl_inode_fini_env));
+
+ cl_inode_fini_env->le_ctx.lc_cookie = 0x4;
+
+ rc = ll_xattr_init();
+ if (rc != 0)
+ GOTO(out_inode_fini_env, rc);
+
+ lustre_register_super_ops(THIS_MODULE, ll_fill_super, 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_tunables:
+ llite_tunables_unregister();
+out_cache:
+ kmem_cache_destroy(ll_inode_cachep);
+ kmem_cache_destroy(ll_file_data_slab);
+ kmem_cache_destroy(pcc_inode_slab);
+ return rc;