- do_update_capa(ocapa, capa);
- ocapa->c_type = type;
- list_add_capa(ocapa, &capa_list[type]);
- hlist_add_head(&ocapa->c_hash, capa_hash);
- if (type == CLIENT_CAPA)
- INIT_LIST_HEAD(&ocapa->c_lli_list);
-
- capa_count[type]++;
-
- DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new");
-
- 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_CACHE, &ocapa->c_capa,
- "free unused");
- __capa_put(tcapa);
- destroy_capa(tcapa);
- count++;
- }
- }
-
- spin_unlock(&capa_lock);
+ ocapa->c_capa = *capa;
+ set_capa_expiry(ocapa);
+ cfs_hlist_add_head(&ocapa->u.tgt.c_hash, head);
+ cfs_list_add_tail(&ocapa->c_list, list);
+ capa_get(ocapa);
+ capa_count[CAPA_SITE_SERVER]++;
+ if (capa_count[CAPA_SITE_SERVER] > CAPA_HASH_SIZE)
+ capa_delete_lru(list);
+ cfs_spin_unlock(&capa_lock);