mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
a61e147e6b
The next commit will introduce nfsd_open_local_fh() which returns an nfsd_file structure. This commit exposes LOCALIO's required NFSD symbols to the NFS client: - Make nfsd_open_local_fh() symbol and other required NFSD symbols available to NFS in a global 'nfs_to' nfsd_localio_operations struct (global access suggested by Trond, nfsd_localio_operations suggested by NeilBrown). The next commit will also introduce nfsd_localio_ops_init() that init_nfsd() will call to initialize 'nfs_to'. - Introduce nfsd_file_file() that provides access to nfsd_file's backing file. Keeps nfsd_file structure opaque to NFS client (as suggested by Jeff Layton). - Introduce nfsd_file_put_local() that will put the reference to the nfsd_file's associated nn->nfsd_serv and then put the reference to the nfsd_file (as suggested by NeilBrown). Suggested-by: Trond Myklebust <trond.myklebust@hammerspace.com> # nfs_to Suggested-by: NeilBrown <neilb@suse.de> # nfsd_localio_operations Suggested-by: Jeff Layton <jlayton@kernel.org> # nfsd_file_file Signed-off-by: Mike Snitzer <snitzer@kernel.org> Reviewed-by: NeilBrown <neilb@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
76 lines
2.9 KiB
C
76 lines
2.9 KiB
C
#ifndef _FS_NFSD_FILECACHE_H
|
|
#define _FS_NFSD_FILECACHE_H
|
|
|
|
#include <linux/fsnotify_backend.h>
|
|
|
|
/*
|
|
* This is the fsnotify_mark container that nfsd attaches to the files that it
|
|
* is holding open. Note that we have a separate refcount here aside from the
|
|
* one in the fsnotify_mark. We only want a single fsnotify_mark attached to
|
|
* the inode, and for each nfsd_file to hold a reference to it.
|
|
*
|
|
* The fsnotify_mark is itself refcounted, but that's not sufficient to tell us
|
|
* how to put that reference. If there are still outstanding nfsd_files that
|
|
* reference the mark, then we would want to call fsnotify_put_mark on it.
|
|
* If there were not, then we'd need to call fsnotify_destroy_mark. Since we
|
|
* can't really tell the difference, we use the nfm_mark to keep track of how
|
|
* many nfsd_files hold references to the mark. When that counter goes to zero
|
|
* then we know to call fsnotify_destroy_mark on it.
|
|
*/
|
|
struct nfsd_file_mark {
|
|
struct fsnotify_mark nfm_mark;
|
|
refcount_t nfm_ref;
|
|
};
|
|
|
|
/*
|
|
* A representation of a file that has been opened by knfsd. These are hashed
|
|
* in the hashtable by inode pointer value. Note that this object doesn't
|
|
* hold a reference to the inode by itself, so the nf_inode pointer should
|
|
* never be dereferenced, only used for comparison.
|
|
*/
|
|
struct nfsd_file {
|
|
struct rhlist_head nf_rlist;
|
|
void *nf_inode;
|
|
struct file *nf_file;
|
|
const struct cred *nf_cred;
|
|
struct net *nf_net;
|
|
#define NFSD_FILE_HASHED (0)
|
|
#define NFSD_FILE_PENDING (1)
|
|
#define NFSD_FILE_REFERENCED (2)
|
|
#define NFSD_FILE_GC (3)
|
|
unsigned long nf_flags;
|
|
refcount_t nf_ref;
|
|
unsigned char nf_may;
|
|
|
|
struct nfsd_file_mark *nf_mark;
|
|
struct list_head nf_lru;
|
|
struct list_head nf_gc;
|
|
struct rcu_head nf_rcu;
|
|
ktime_t nf_birthtime;
|
|
};
|
|
|
|
int nfsd_file_cache_init(void);
|
|
void nfsd_file_cache_purge(struct net *);
|
|
void nfsd_file_cache_shutdown(void);
|
|
int nfsd_file_cache_start_net(struct net *net);
|
|
void nfsd_file_cache_shutdown_net(struct net *net);
|
|
void nfsd_file_put(struct nfsd_file *nf);
|
|
void nfsd_file_put_local(struct nfsd_file *nf);
|
|
struct nfsd_file *nfsd_file_get(struct nfsd_file *nf);
|
|
struct file *nfsd_file_file(struct nfsd_file *nf);
|
|
void nfsd_file_close_inode_sync(struct inode *inode);
|
|
void nfsd_file_net_dispose(struct nfsd_net *nn);
|
|
bool nfsd_file_is_cached(struct inode *inode);
|
|
__be32 nfsd_file_acquire_gc(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|
unsigned int may_flags, struct nfsd_file **nfp);
|
|
__be32 nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|
unsigned int may_flags, struct nfsd_file **nfp);
|
|
__be32 nfsd_file_acquire_opened(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|
unsigned int may_flags, struct file *file,
|
|
struct nfsd_file **nfp);
|
|
__be32 nfsd_file_acquire_local(struct net *net, struct svc_cred *cred,
|
|
struct auth_domain *client, struct svc_fh *fhp,
|
|
unsigned int may_flags, struct nfsd_file **pnf);
|
|
int nfsd_file_cache_stats_show(struct seq_file *m, void *v);
|
|
#endif /* _FS_NFSD_FILECACHE_H */
|