- if (type == CLIENT_CAPA) {
- LASSERT(inode);
- LASSERT(handle);
-#ifdef __KERNEL__
- igrab(inode);
-#endif
- ocapa->c_inode = inode;
- memcpy(&ocapa->c_handle, handle, sizeof(*handle));
- }
-
- DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new");
-
- list_add_capa(ocapa, &capa_list[type]);
- hlist_add_head(&ocapa->c_hash, capa_hash);
- capa_count[type]++;
-
- __capa_get(ocapa);
-
- if (type != CLIENT_CAPA && capa_count[type] > CAPA_CACHE_SIZE) {
- struct list_head *node = capa_list[type].next;
- struct obd_capa *tcapa;
- int count = 0;
-
- /* free 12 unused capa from head */
- while (node->next != &capa_list[type] && count < 12) {
- tcapa = list_entry(node, struct obd_capa, c_list);
- node = node->next;
- if (atomic_read(&tcapa->c_refc) > 0)
- continue;
- list_del(&tcapa->c_list);
- hlist_del(&tcapa->c_hash);
- destroy_capa(tcapa);
- capa_count[type]--;
- count++;
- }
- }
-
- spin_unlock(&capa_lock);
- return ocapa;
+ tfm = ll_crypto_alloc_hash(alg->ha_name, 0, 0);
+ if (!tfm) {
+ CERROR("crypto_alloc_tfm failed, check whether your kernel"
+ "has crypto support!\n");
+ return -ENOMEM;