• Home
  • Raw
  • Download

Lines Matching refs:cache

64 	struct nfs4_xattr_cache *cache;  member
106 nfs4_xattr_hash_init(struct nfs4_xattr_cache *cache) in nfs4_xattr_hash_init() argument
111 INIT_HLIST_HEAD(&cache->buckets[i].hlist); in nfs4_xattr_hash_init()
112 spin_lock_init(&cache->buckets[i].lock); in nfs4_xattr_hash_init()
113 cache->buckets[i].cache = cache; in nfs4_xattr_hash_init()
114 cache->buckets[i].draining = false; in nfs4_xattr_hash_init()
270 struct nfs4_xattr_cache *cache; in nfs4_xattr_free_cache_cb() local
273 cache = container_of(kref, struct nfs4_xattr_cache, ref); in nfs4_xattr_free_cache_cb()
276 if (WARN_ON(!hlist_empty(&cache->buckets[i].hlist))) in nfs4_xattr_free_cache_cb()
278 cache->buckets[i].draining = false; in nfs4_xattr_free_cache_cb()
281 cache->listxattr = NULL; in nfs4_xattr_free_cache_cb()
283 kmem_cache_free(nfs4_xattr_cache_cachep, cache); in nfs4_xattr_free_cache_cb()
290 struct nfs4_xattr_cache *cache; in nfs4_xattr_alloc_cache() local
292 cache = kmem_cache_alloc(nfs4_xattr_cache_cachep, GFP_KERNEL); in nfs4_xattr_alloc_cache()
293 if (cache == NULL) in nfs4_xattr_alloc_cache()
296 kref_init(&cache->ref); in nfs4_xattr_alloc_cache()
297 atomic_long_set(&cache->nent, 0); in nfs4_xattr_alloc_cache()
299 return cache; in nfs4_xattr_alloc_cache()
309 nfs4_xattr_set_listcache(struct nfs4_xattr_cache *cache, in nfs4_xattr_set_listcache() argument
315 spin_lock(&cache->listxattr_lock); in nfs4_xattr_set_listcache()
317 old = cache->listxattr; in nfs4_xattr_set_listcache()
324 cache->listxattr = new; in nfs4_xattr_set_listcache()
333 spin_unlock(&cache->listxattr_lock); in nfs4_xattr_set_listcache()
384 nfs4_xattr_discard_cache(struct nfs4_xattr_cache *cache) in nfs4_xattr_discard_cache() argument
391 nfs4_xattr_set_listcache(cache, ERR_PTR(-ESTALE)); in nfs4_xattr_discard_cache()
394 bucket = &cache->buckets[i]; in nfs4_xattr_discard_cache()
406 atomic_long_set(&cache->nent, 0); in nfs4_xattr_discard_cache()
408 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_discard_cache()
429 struct nfs4_xattr_cache *cache, *oldcache, *newcache; in nfs4_xattr_get_cache() local
433 cache = oldcache = NULL; in nfs4_xattr_get_cache()
440 cache = nfsi->xattr_cache; in nfs4_xattr_get_cache()
442 if (cache != NULL) in nfs4_xattr_get_cache()
443 kref_get(&cache->ref); in nfs4_xattr_get_cache()
447 if (add && cache == NULL) { in nfs4_xattr_get_cache()
450 cache = nfs4_xattr_alloc_cache(); in nfs4_xattr_get_cache()
451 if (cache == NULL) in nfs4_xattr_get_cache()
462 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_get_cache()
463 cache = NULL; in nfs4_xattr_get_cache()
474 kref_get(&cache->ref); in nfs4_xattr_get_cache()
475 nfsi->xattr_cache = cache; in nfs4_xattr_get_cache()
476 cache->inode = inode; in nfs4_xattr_get_cache()
477 list_lru_add(&nfs4_xattr_cache_lru, &cache->lru); in nfs4_xattr_get_cache()
488 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_get_cache()
489 cache = newcache; in nfs4_xattr_get_cache()
500 return cache; in nfs4_xattr_get_cache()
504 nfs4_xattr_hash_bucket(struct nfs4_xattr_cache *cache, const char *name) in nfs4_xattr_hash_bucket() argument
506 return &cache->buckets[jhash(name, strlen(name), 0) & in nfs4_xattr_hash_bucket()
507 (ARRAY_SIZE(cache->buckets) - 1)]; in nfs4_xattr_hash_bucket()
526 nfs4_xattr_hash_add(struct nfs4_xattr_cache *cache, in nfs4_xattr_hash_add() argument
533 bucket = nfs4_xattr_hash_bucket(cache, entry->xattr_name); in nfs4_xattr_hash_add()
548 atomic_long_inc(&cache->nent); in nfs4_xattr_hash_add()
564 nfs4_xattr_hash_remove(struct nfs4_xattr_cache *cache, const char *name) in nfs4_xattr_hash_remove() argument
569 bucket = nfs4_xattr_hash_bucket(cache, name); in nfs4_xattr_hash_remove()
577 atomic_long_dec(&cache->nent); in nfs4_xattr_hash_remove()
587 nfs4_xattr_hash_find(struct nfs4_xattr_cache *cache, const char *name) in nfs4_xattr_hash_find() argument
592 bucket = nfs4_xattr_hash_bucket(cache, name); in nfs4_xattr_hash_find()
611 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_get() local
615 cache = nfs4_xattr_get_cache(inode, 0); in nfs4_xattr_cache_get()
616 if (cache == NULL) in nfs4_xattr_cache_get()
620 entry = nfs4_xattr_hash_find(cache, name); in nfs4_xattr_cache_get()
640 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_get()
650 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_list() local
654 cache = nfs4_xattr_get_cache(inode, 0); in nfs4_xattr_cache_list()
655 if (cache == NULL) in nfs4_xattr_cache_list()
658 spin_lock(&cache->listxattr_lock); in nfs4_xattr_cache_list()
660 entry = cache->listxattr; in nfs4_xattr_cache_list()
676 spin_unlock(&cache->listxattr_lock); in nfs4_xattr_cache_list()
678 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_list()
691 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_add() local
697 cache = nfs4_xattr_get_cache(inode, 1); in nfs4_xattr_cache_add()
698 if (cache == NULL) in nfs4_xattr_cache_add()
705 (void)nfs4_xattr_set_listcache(cache, NULL); in nfs4_xattr_cache_add()
707 if (!nfs4_xattr_hash_add(cache, entry)) in nfs4_xattr_cache_add()
711 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_add()
722 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_remove() local
726 cache = nfs4_xattr_get_cache(inode, 0); in nfs4_xattr_cache_remove()
727 if (cache == NULL) in nfs4_xattr_cache_remove()
730 (void)nfs4_xattr_set_listcache(cache, NULL); in nfs4_xattr_cache_remove()
731 nfs4_xattr_hash_remove(cache, name); in nfs4_xattr_cache_remove()
733 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_remove()
742 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_set_list() local
745 cache = nfs4_xattr_get_cache(inode, 1); in nfs4_xattr_cache_set_list()
746 if (cache == NULL) in nfs4_xattr_cache_set_list()
758 entry->bucket = &cache->buckets[0]; in nfs4_xattr_cache_set_list()
760 if (!nfs4_xattr_set_listcache(cache, entry)) in nfs4_xattr_cache_set_list()
764 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_set_list()
828 struct nfs4_xattr_cache *cache = container_of(item, in cache_lru_isolate() local
831 if (atomic_long_read(&cache->nent) > 1) in cache_lru_isolate()
839 inode = cache->inode; in cache_lru_isolate()
844 kref_get(&cache->ref); in cache_lru_isolate()
846 cache->inode = NULL; in cache_lru_isolate()
849 list_lru_isolate(lru, &cache->lru); in cache_lru_isolate()
853 list_add_tail(&cache->dispose, dispose); in cache_lru_isolate()
862 struct nfs4_xattr_cache *cache; in nfs4_xattr_cache_scan() local
867 cache = list_first_entry(&dispose, struct nfs4_xattr_cache, in nfs4_xattr_cache_scan()
869 list_del_init(&cache->dispose); in nfs4_xattr_cache_scan()
870 nfs4_xattr_discard_cache(cache); in nfs4_xattr_cache_scan()
871 kref_put(&cache->ref, nfs4_xattr_free_cache_cb); in nfs4_xattr_cache_scan()
893 struct nfs4_xattr_cache *cache; in entry_lru_isolate() local
898 cache = bucket->cache; in entry_lru_isolate()
917 atomic_long_dec(&cache->nent); in entry_lru_isolate()
923 if (!spin_trylock(&cache->listxattr_lock)) in entry_lru_isolate()
928 cache->listxattr = NULL; in entry_lru_isolate()
931 spin_unlock(&cache->listxattr_lock); in entry_lru_isolate()
984 struct nfs4_xattr_cache *cache = p; in nfs4_xattr_cache_init_once() local
986 spin_lock_init(&cache->listxattr_lock); in nfs4_xattr_cache_init_once()
987 atomic_long_set(&cache->nent, 0); in nfs4_xattr_cache_init_once()
988 nfs4_xattr_hash_init(cache); in nfs4_xattr_cache_init_once()
989 cache->listxattr = NULL; in nfs4_xattr_cache_init_once()
990 INIT_LIST_HEAD(&cache->lru); in nfs4_xattr_cache_init_once()
991 INIT_LIST_HEAD(&cache->dispose); in nfs4_xattr_cache_init_once()