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