Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) #ifndef _FS_NFSD_FILECACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #define _FS_NFSD_FILECACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/fsnotify_backend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * This is the fsnotify_mark container that nfsd attaches to the files that it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * is holding open. Note that we have a separate refcount here aside from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * one in the fsnotify_mark. We only want a single fsnotify_mark attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * the inode, and for each nfsd_file to hold a reference to it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * The fsnotify_mark is itself refcounted, but that's not sufficient to tell us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * how to put that reference. If there are still outstanding nfsd_files that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * reference the mark, then we would want to call fsnotify_put_mark on it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * If there were not, then we'd need to call fsnotify_destroy_mark. Since we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * can't really tell the difference, we use the nfm_mark to keep track of how
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * many nfsd_files hold references to the mark. When that counter goes to zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * then we know to call fsnotify_destroy_mark on it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct nfsd_file_mark {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct fsnotify_mark	nfm_mark;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	refcount_t		nfm_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * A representation of a file that has been opened by knfsd. These are hashed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * in the hashtable by inode pointer value. Note that this object doesn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  * hold a reference to the inode by itself, so the nf_inode pointer should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * never be dereferenced, only used for comparison.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct nfsd_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	struct hlist_node	nf_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	struct list_head	nf_lru;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct rcu_head		nf_rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	struct file		*nf_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	const struct cred	*nf_cred;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	struct net		*nf_net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define NFSD_FILE_HASHED	(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define NFSD_FILE_PENDING	(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define NFSD_FILE_BREAK_READ	(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define NFSD_FILE_BREAK_WRITE	(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define NFSD_FILE_REFERENCED	(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	unsigned long		nf_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	struct inode		*nf_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	unsigned int		nf_hashval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	refcount_t		nf_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	unsigned char		nf_may;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct nfsd_file_mark	*nf_mark;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	struct rw_semaphore	nf_rwsem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int nfsd_file_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void nfsd_file_cache_purge(struct net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void nfsd_file_cache_shutdown(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int nfsd_file_cache_start_net(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) void nfsd_file_cache_shutdown_net(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void nfsd_file_put(struct nfsd_file *nf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct nfsd_file *nfsd_file_get(struct nfsd_file *nf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void nfsd_file_close_inode_sync(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) bool nfsd_file_is_cached(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __be32 nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		  unsigned int may_flags, struct nfsd_file **nfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int	nfsd_file_cache_stats_open(struct inode *, struct file *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif /* _FS_NFSD_FILECACHE_H */