xref: /openbmc/linux/fs/nfs/cache_lib.h (revision 0896cade1224f167296c786043e9bdc0ca63d392)
1e571cbf1STrond Myklebust /*
2e571cbf1STrond Myklebust  * Helper routines for the NFS client caches
3e571cbf1STrond Myklebust  *
4e571cbf1STrond Myklebust  * Copyright (c) 2009 Trond Myklebust <Trond.Myklebust@netapp.com>
5e571cbf1STrond Myklebust  */
6e571cbf1STrond Myklebust 
7e571cbf1STrond Myklebust #include <linux/completion.h>
8e571cbf1STrond Myklebust #include <linux/sunrpc/cache.h>
960063497SArun Sharma #include <linux/atomic.h>
10e571cbf1STrond Myklebust 
11e571cbf1STrond Myklebust /*
12e571cbf1STrond Myklebust  * Deferred request handling
13e571cbf1STrond Myklebust  */
14e571cbf1STrond Myklebust struct nfs_cache_defer_req {
15e571cbf1STrond Myklebust 	struct cache_req req;
16e571cbf1STrond Myklebust 	struct cache_deferred_req deferred_req;
17e571cbf1STrond Myklebust 	struct completion completion;
18*0896cadeSElena Reshetova 	refcount_t count;
19e571cbf1STrond Myklebust };
20e571cbf1STrond Myklebust 
21e571cbf1STrond Myklebust extern int nfs_cache_upcall(struct cache_detail *cd, char *entry_name);
22e571cbf1STrond Myklebust extern struct nfs_cache_defer_req *nfs_cache_defer_req_alloc(void);
23e571cbf1STrond Myklebust extern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq);
24e571cbf1STrond Myklebust extern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq);
25e571cbf1STrond Myklebust 
265c1cacb1SStanislav Kinsbursky extern int nfs_cache_register_net(struct net *net, struct cache_detail *cd);
275c1cacb1SStanislav Kinsbursky extern void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd);
289df69c81SStanislav Kinsbursky extern int nfs_cache_register_sb(struct super_block *sb,
299df69c81SStanislav Kinsbursky 				 struct cache_detail *cd);
309df69c81SStanislav Kinsbursky extern void nfs_cache_unregister_sb(struct super_block *sb,
319df69c81SStanislav Kinsbursky 				    struct cache_detail *cd);
32