xref: /linux/fs/nfs/cache_lib.h (revision c79c3c34f75d72a066e292b10aa50fc758c97c89)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Helper routines for the NFS client caches
4  *
5  * Copyright (c) 2009 Trond Myklebust <Trond.Myklebust@netapp.com>
6  */
7 
8 #include <linux/completion.h>
9 #include <linux/sunrpc/cache.h>
10 #include <linux/atomic.h>
11 
12 /*
13  * Deferred request handling
14  */
15 struct nfs_cache_defer_req {
16 	struct cache_req req;
17 	struct cache_deferred_req deferred_req;
18 	struct completion completion;
19 	refcount_t count;
20 };
21 
22 extern int nfs_cache_upcall(struct cache_detail *cd, char *entry_name);
23 extern struct nfs_cache_defer_req *nfs_cache_defer_req_alloc(void);
24 extern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq);
25 extern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq);
26 
27 extern int nfs_cache_register_net(struct net *net, struct cache_detail *cd);
28 extern void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd);
29 extern int nfs_cache_register_sb(struct super_block *sb,
30 				 struct cache_detail *cd);
31 extern void nfs_cache_unregister_sb(struct super_block *sb,
32 				    struct cache_detail *cd);
33