18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Helper routines for the NFS client caches
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2009 Trond Myklebust <Trond.Myklebust@netapp.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/completion.h>
98c2ecf20Sopenharmony_ci#include <linux/sunrpc/cache.h>
108c2ecf20Sopenharmony_ci#include <linux/atomic.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Deferred request handling
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_cistruct nfs_cache_defer_req {
168c2ecf20Sopenharmony_ci	struct cache_req req;
178c2ecf20Sopenharmony_ci	struct cache_deferred_req deferred_req;
188c2ecf20Sopenharmony_ci	struct completion completion;
198c2ecf20Sopenharmony_ci	refcount_t count;
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciextern int nfs_cache_upcall(struct cache_detail *cd, char *entry_name);
238c2ecf20Sopenharmony_ciextern struct nfs_cache_defer_req *nfs_cache_defer_req_alloc(void);
248c2ecf20Sopenharmony_ciextern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq);
258c2ecf20Sopenharmony_ciextern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciextern int nfs_cache_register_net(struct net *net, struct cache_detail *cd);
288c2ecf20Sopenharmony_ciextern void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd);
298c2ecf20Sopenharmony_ciextern int nfs_cache_register_sb(struct super_block *sb,
308c2ecf20Sopenharmony_ci				 struct cache_detail *cd);
318c2ecf20Sopenharmony_ciextern void nfs_cache_unregister_sb(struct super_block *sb,
328c2ecf20Sopenharmony_ci				    struct cache_detail *cd);
33