- list_add_tail(&ocapa->c_list, head);
-}
-
-static inline void do_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa)
-{
- memcpy(&ocapa->c_capa, capa, sizeof(*capa));
-}
-
-static struct obd_capa *
-get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa)
-{
- uid_t uid = capa->lc_uid;
- int capa_op = capa->lc_op;
- __u64 mdsid = capa->lc_mdsid;
- unsigned long ino = capa->lc_ino;
- struct obd_capa *ocapa, *old;
-
- ocapa = alloc_capa();
- if (!ocapa)
- return NULL;
-
- spin_lock(&capa_lock);
-
- if (type == FILTER_CAPA)
- old = filter_find_capa(head, capa);
- else
- old = find_capa(head, uid, capa_op, mdsid, ino,
- capa->lc_igen, type);
-
- if (!old) {
- do_update_capa(ocapa, capa);
- ocapa->c_type = type;
- list_add_capa(ocapa, &capa_list[type]);
- hlist_add_head(&ocapa->c_hash, head);
- if (type == CLIENT_CAPA)
- INIT_LIST_HEAD(&ocapa->c_lli_list);
- __capa_get(ocapa);
-
- capa_count[type]++;
-
- DEBUG_CAPA(D_INODE, &ocapa->c_capa, "new %s",
- capa_type_name[type]);
-
- 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;
- DEBUG_CAPA(D_INODE, &tcapa->c_capa,
- "free unused %s",
- capa_type_name[type]);
- __capa_put(tcapa);
- destroy_capa(tcapa);
- count++;
- }
- }
-
- spin_unlock(&capa_lock);
- return ocapa;
+ sg_set_page(&sd, virt_to_page(d), 16,
+ (unsigned long)(d) % CFS_PAGE_SIZE);
+
+ sg_set_page(&ss, virt_to_page(s), 16,
+ (unsigned long)(s) % CFS_PAGE_SIZE);
+ desc.tfm = tfm;
+ desc.info = NULL;
+ desc.flags = 0;
+ rc = ll_crypto_blkcipher_encrypt(&desc, &sd, &ss, 16);
+ if (rc) {
+ CERROR("failed to encrypt for aes\n");
+ GOTO(out, rc);