diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/staging/lustre/lustre/llite/super25.c | 141 |
1 files changed, 72 insertions, 69 deletions
diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 6aff155651cc..7c1e02a031ba 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c | |||
| @@ -72,21 +72,6 @@ static void ll_destroy_inode(struct inode *inode) | |||
| 72 | call_rcu(&inode->i_rcu, ll_inode_destroy_callback); | 72 | call_rcu(&inode->i_rcu, ll_inode_destroy_callback); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static int ll_init_inodecache(void) | ||
| 76 | { | ||
| 77 | ll_inode_cachep = kmem_cache_create("lustre_inode_cache", | ||
| 78 | sizeof(struct ll_inode_info), | ||
| 79 | 0, SLAB_HWCACHE_ALIGN, NULL); | ||
| 80 | if (ll_inode_cachep == NULL) | ||
| 81 | return -ENOMEM; | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | static void ll_destroy_inodecache(void) | ||
| 86 | { | ||
| 87 | kmem_cache_destroy(ll_inode_cachep); | ||
| 88 | } | ||
| 89 | |||
| 90 | /* exported operations */ | 75 | /* exported operations */ |
| 91 | struct super_operations lustre_super_operations = { | 76 | struct super_operations lustre_super_operations = { |
| 92 | .alloc_inode = ll_alloc_inode, | 77 | .alloc_inode = ll_alloc_inode, |
| @@ -104,9 +89,10 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg)); | |||
| 104 | 89 | ||
| 105 | static int __init init_lustre_lite(void) | 90 | static int __init init_lustre_lite(void) |
| 106 | { | 91 | { |
| 107 | int i, rc, seed[2]; | 92 | struct proc_dir_entry *entry; |
| 108 | struct timeval tv; | ||
| 109 | lnet_process_id_t lnet_id; | 93 | lnet_process_id_t lnet_id; |
| 94 | struct timeval tv; | ||
| 95 | int i, rc, seed[2]; | ||
| 110 | 96 | ||
| 111 | CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1); | 97 | CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1); |
| 112 | 98 | ||
| @@ -116,59 +102,52 @@ static int __init init_lustre_lite(void) | |||
| 116 | CDEBUG(D_INFO, "Lustre client module (%p).\n", | 102 | CDEBUG(D_INFO, "Lustre client module (%p).\n", |
| 117 | &lustre_super_operations); | 103 | &lustre_super_operations); |
| 118 | 104 | ||
| 119 | rc = ll_init_inodecache(); | 105 | rc = -ENOMEM; |
| 120 | if (rc) | 106 | ll_inode_cachep = kmem_cache_create("lustre_inode_cache", |
| 121 | return -ENOMEM; | 107 | sizeof(struct ll_inode_info), |
| 108 | 0, SLAB_HWCACHE_ALIGN, NULL); | ||
| 109 | if (ll_inode_cachep == NULL) | ||
| 110 | goto out_cache; | ||
| 111 | |||
| 122 | ll_file_data_slab = kmem_cache_create("ll_file_data", | 112 | ll_file_data_slab = kmem_cache_create("ll_file_data", |
| 123 | sizeof(struct ll_file_data), 0, | 113 | sizeof(struct ll_file_data), 0, |
| 124 | SLAB_HWCACHE_ALIGN, NULL); | 114 | SLAB_HWCACHE_ALIGN, NULL); |
| 125 | if (ll_file_data_slab == NULL) { | 115 | if (ll_file_data_slab == NULL) |
| 126 | ll_destroy_inodecache(); | 116 | goto out_cache; |
| 127 | return -ENOMEM; | ||
| 128 | } | ||
| 129 | 117 | ||
| 130 | ll_remote_perm_cachep = kmem_cache_create("ll_remote_perm_cache", | 118 | ll_remote_perm_cachep = kmem_cache_create("ll_remote_perm_cache", |
| 131 | sizeof(struct ll_remote_perm), | 119 | sizeof(struct ll_remote_perm), |
| 132 | 0, 0, NULL); | 120 | 0, 0, NULL); |
| 133 | if (ll_remote_perm_cachep == NULL) { | 121 | if (ll_remote_perm_cachep == NULL) |
| 134 | kmem_cache_destroy(ll_file_data_slab); | 122 | goto out_cache; |
| 135 | ll_file_data_slab = NULL; | ||
| 136 | ll_destroy_inodecache(); | ||
| 137 | return -ENOMEM; | ||
| 138 | } | ||
| 139 | 123 | ||
| 140 | ll_rmtperm_hash_cachep = kmem_cache_create("ll_rmtperm_hash_cache", | 124 | ll_rmtperm_hash_cachep = kmem_cache_create("ll_rmtperm_hash_cache", |
| 141 | REMOTE_PERM_HASHSIZE * | 125 | REMOTE_PERM_HASHSIZE * |
| 142 | sizeof(struct list_head), | 126 | sizeof(struct list_head), |
| 143 | 0, 0, NULL); | 127 | 0, 0, NULL); |
| 144 | if (ll_rmtperm_hash_cachep == NULL) { | 128 | if (ll_rmtperm_hash_cachep == NULL) |
| 145 | kmem_cache_destroy(ll_remote_perm_cachep); | 129 | goto out_cache; |
| 146 | ll_remote_perm_cachep = NULL; | 130 | |
| 147 | kmem_cache_destroy(ll_file_data_slab); | 131 | entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL); |
| 148 | ll_file_data_slab = NULL; | 132 | if (IS_ERR(entry)) { |
| 149 | ll_destroy_inodecache(); | 133 | rc = PTR_ERR(entry); |
| 150 | return -ENOMEM; | 134 | CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n", |
| 135 | rc); | ||
| 136 | goto out_cache; | ||
| 151 | } | 137 | } |
| 152 | 138 | ||
| 153 | proc_lustre_fs_root = proc_lustre_root ? | 139 | proc_lustre_fs_root = entry; |
| 154 | lprocfs_register("llite", proc_lustre_root, NULL, NULL) : NULL; | ||
| 155 | |||
| 156 | lustre_register_client_fill_super(ll_fill_super); | ||
| 157 | lustre_register_kill_super_cb(ll_kill_super); | ||
| 158 | |||
| 159 | lustre_register_client_process_config(ll_process_config); | ||
| 160 | 140 | ||
| 161 | cfs_get_random_bytes(seed, sizeof(seed)); | 141 | cfs_get_random_bytes(seed, sizeof(seed)); |
| 162 | 142 | ||
| 163 | /* Nodes with small feet have little entropy | 143 | /* Nodes with small feet have little entropy. The NID for this |
| 164 | * the NID for this node gives the most entropy in the low bits */ | 144 | * node gives the most entropy in the low bits */ |
| 165 | for (i = 0; ; i++) { | 145 | for (i = 0;; i++) { |
| 166 | if (LNetGetId(i, &lnet_id) == -ENOENT) { | 146 | if (LNetGetId(i, &lnet_id) == -ENOENT) |
| 167 | break; | 147 | break; |
| 168 | } | 148 | |
| 169 | if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) { | 149 | if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) |
| 170 | seed[0] ^= LNET_NIDADDR(lnet_id.nid); | 150 | seed[0] ^= LNET_NIDADDR(lnet_id.nid); |
| 171 | } | ||
| 172 | } | 151 | } |
| 173 | 152 | ||
| 174 | do_gettimeofday(&tv); | 153 | do_gettimeofday(&tv); |
| @@ -177,20 +156,54 @@ static int __init init_lustre_lite(void) | |||
| 177 | init_timer(&ll_capa_timer); | 156 | init_timer(&ll_capa_timer); |
| 178 | ll_capa_timer.function = ll_capa_timer_callback; | 157 | ll_capa_timer.function = ll_capa_timer_callback; |
| 179 | rc = ll_capa_thread_start(); | 158 | rc = ll_capa_thread_start(); |
| 180 | /* | 159 | if (rc != 0) |
| 181 | * XXX normal cleanup is needed here. | 160 | goto out_proc; |
| 182 | */ | ||
| 183 | if (rc == 0) | ||
| 184 | rc = vvp_global_init(); | ||
| 185 | 161 | ||
| 186 | if (rc == 0) | 162 | rc = vvp_global_init(); |
| 187 | rc = ll_xattr_init(); | 163 | if (rc != 0) |
| 164 | goto out_capa; | ||
| 165 | |||
| 166 | rc = ll_xattr_init(); | ||
| 167 | if (rc != 0) | ||
| 168 | goto out_vvp; | ||
| 169 | |||
| 170 | lustre_register_client_fill_super(ll_fill_super); | ||
| 171 | lustre_register_kill_super_cb(ll_kill_super); | ||
| 172 | lustre_register_client_process_config(ll_process_config); | ||
| 173 | |||
| 174 | return 0; | ||
| 175 | |||
| 176 | out_vvp: | ||
| 177 | vvp_global_fini(); | ||
| 178 | out_capa: | ||
| 179 | del_timer(&ll_capa_timer); | ||
| 180 | ll_capa_thread_stop(); | ||
| 181 | out_proc: | ||
| 182 | lprocfs_remove(&proc_lustre_fs_root); | ||
| 183 | out_cache: | ||
| 184 | if (ll_inode_cachep != NULL) | ||
| 185 | kmem_cache_destroy(ll_inode_cachep); | ||
| 186 | |||
| 187 | if (ll_file_data_slab != NULL) | ||
| 188 | kmem_cache_destroy(ll_file_data_slab); | ||
| 189 | |||
| 190 | if (ll_remote_perm_cachep != NULL) | ||
| 191 | kmem_cache_destroy(ll_remote_perm_cachep); | ||
| 192 | |||
| 193 | if (ll_rmtperm_hash_cachep != NULL) | ||
| 194 | kmem_cache_destroy(ll_rmtperm_hash_cachep); | ||
| 188 | 195 | ||
| 189 | return rc; | 196 | return rc; |
| 190 | } | 197 | } |
| 191 | 198 | ||
| 192 | static void __exit exit_lustre_lite(void) | 199 | static void __exit exit_lustre_lite(void) |
| 193 | { | 200 | { |
| 201 | lustre_register_client_fill_super(NULL); | ||
| 202 | lustre_register_kill_super_cb(NULL); | ||
| 203 | lustre_register_client_process_config(NULL); | ||
| 204 | |||
| 205 | lprocfs_remove(&proc_lustre_fs_root); | ||
| 206 | |||
| 194 | ll_xattr_fini(); | 207 | ll_xattr_fini(); |
| 195 | vvp_global_fini(); | 208 | vvp_global_fini(); |
| 196 | del_timer(&ll_capa_timer); | 209 | del_timer(&ll_capa_timer); |
| @@ -199,22 +212,12 @@ static void __exit exit_lustre_lite(void) | |||
| 199 | "client remaining capa count %d\n", | 212 | "client remaining capa count %d\n", |
| 200 | capa_count[CAPA_SITE_CLIENT]); | 213 | capa_count[CAPA_SITE_CLIENT]); |
| 201 | 214 | ||
| 202 | lustre_register_client_fill_super(NULL); | 215 | kmem_cache_destroy(ll_inode_cachep); |
| 203 | lustre_register_kill_super_cb(NULL); | ||
| 204 | |||
| 205 | lustre_register_client_process_config(NULL); | ||
| 206 | |||
| 207 | ll_destroy_inodecache(); | ||
| 208 | |||
| 209 | kmem_cache_destroy(ll_rmtperm_hash_cachep); | 216 | kmem_cache_destroy(ll_rmtperm_hash_cachep); |
| 210 | ll_rmtperm_hash_cachep = NULL; | ||
| 211 | 217 | ||
| 212 | kmem_cache_destroy(ll_remote_perm_cachep); | 218 | kmem_cache_destroy(ll_remote_perm_cachep); |
| 213 | ll_remote_perm_cachep = NULL; | ||
| 214 | 219 | ||
| 215 | kmem_cache_destroy(ll_file_data_slab); | 220 | kmem_cache_destroy(ll_file_data_slab); |
| 216 | if (proc_lustre_fs_root && !IS_ERR(proc_lustre_fs_root)) | ||
| 217 | lprocfs_remove(&proc_lustre_fs_root); | ||
| 218 | } | 221 | } |
| 219 | 222 | ||
| 220 | MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>"); | 223 | MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>"); |
