aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/nfs_fs.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r--include/linux/nfs_fs.h159
1 files changed, 106 insertions, 53 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1cc25682b20..fc0fd15c28d 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -5,18 +5,38 @@
5 * 5 *
6 * OS-specific nfs filesystem definitions and declarations 6 * OS-specific nfs filesystem definitions and declarations
7 */ 7 */
8
8#ifndef _LINUX_NFS_FS_H 9#ifndef _LINUX_NFS_FS_H
9#define _LINUX_NFS_FS_H 10#define _LINUX_NFS_FS_H
10 11
11#include <uapi/linux/nfs_fs.h> 12#include <linux/magic.h>
13
14/* Default timeout values */
15#define NFS_DEF_UDP_TIMEO (11)
16#define NFS_DEF_UDP_RETRANS (3)
17#define NFS_DEF_TCP_TIMEO (600)
18#define NFS_DEF_TCP_RETRANS (2)
19
20#define NFS_MAX_UDP_TIMEOUT (60*HZ)
21#define NFS_MAX_TCP_TIMEOUT (600*HZ)
12 22
23#define NFS_DEF_ACREGMIN (3)
24#define NFS_DEF_ACREGMAX (60)
25#define NFS_DEF_ACDIRMIN (30)
26#define NFS_DEF_ACDIRMAX (60)
13 27
14/* 28/*
15 * Enable dprintk() debugging support for nfs client. 29 * When flushing a cluster of dirty pages, there can be different
30 * strategies:
16 */ 31 */
17#ifdef CONFIG_NFS_DEBUG 32#define FLUSH_SYNC 1 /* file being synced, or contention */
18# define NFS_DEBUG 33#define FLUSH_STABLE 4 /* commit to stable storage */
19#endif 34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
38
39#ifdef __KERNEL__
20 40
21#include <linux/in.h> 41#include <linux/in.h>
22#include <linux/mm.h> 42#include <linux/mm.h>
@@ -54,16 +74,12 @@ struct nfs_access_entry {
54 int mask; 74 int mask;
55}; 75};
56 76
57struct nfs_lockowner {
58 fl_owner_t l_owner;
59 pid_t l_pid;
60};
61
62struct nfs_lock_context { 77struct nfs_lock_context {
63 atomic_t count; 78 atomic_t count;
64 struct list_head list; 79 struct list_head list;
65 struct nfs_open_context *open_context; 80 struct nfs_open_context *open_context;
66 struct nfs_lockowner lockowner; 81 fl_owner_t lockowner;
82 pid_t pid;
67}; 83};
68 84
69struct nfs4_state; 85struct nfs4_state;
@@ -76,11 +92,9 @@ struct nfs_open_context {
76 92
77 unsigned long flags; 93 unsigned long flags;
78#define NFS_CONTEXT_ERROR_WRITE (0) 94#define NFS_CONTEXT_ERROR_WRITE (0)
79#define NFS_CONTEXT_RESEND_WRITES (1)
80 int error; 95 int error;
81 96
82 struct list_head list; 97 struct list_head list;
83 struct nfs4_threshold *mdsthreshold;
84}; 98};
85 99
86struct nfs_open_dir_context { 100struct nfs_open_dir_context {
@@ -135,6 +149,7 @@ struct nfs_inode {
135 unsigned long read_cache_jiffies; 149 unsigned long read_cache_jiffies;
136 unsigned long attrtimeo; 150 unsigned long attrtimeo;
137 unsigned long attrtimeo_timestamp; 151 unsigned long attrtimeo_timestamp;
152 __u64 change_attr; /* v4 only */
138 153
139 unsigned long attr_gencount; 154 unsigned long attr_gencount;
140 /* "Generation counter" for the attribute cache. This is 155 /* "Generation counter" for the attribute cache. This is
@@ -157,8 +172,13 @@ struct nfs_inode {
157 */ 172 */
158 __be32 cookieverf[2]; 173 __be32 cookieverf[2];
159 174
175 /*
176 * This is the list of dirty unwritten pages.
177 */
178 struct radix_tree_root nfs_page_tree;
179
160 unsigned long npages; 180 unsigned long npages;
161 struct nfs_mds_commit_info commit_info; 181 unsigned long ncommit;
162 182
163 /* Open contexts for shared mmap writes */ 183 /* Open contexts for shared mmap writes */
164 struct list_head open_files; 184 struct list_head open_files;
@@ -169,7 +189,7 @@ struct nfs_inode {
169 struct hlist_head silly_list; 189 struct hlist_head silly_list;
170 wait_queue_head_t waitqueue; 190 wait_queue_head_t waitqueue;
171 191
172#if IS_ENABLED(CONFIG_NFS_V4) 192#ifdef CONFIG_NFS_V4
173 struct nfs4_cached_acl *nfs4_acl; 193 struct nfs4_cached_acl *nfs4_acl;
174 /* NFSv4 state */ 194 /* NFSv4 state */
175 struct list_head open_states; 195 struct list_head open_states;
@@ -179,10 +199,8 @@ struct nfs_inode {
179 199
180 /* pNFS layout information */ 200 /* pNFS layout information */
181 struct pnfs_layout_hdr *layout; 201 struct pnfs_layout_hdr *layout;
202 atomic_t commits_outstanding;
182#endif /* CONFIG_NFS_V4*/ 203#endif /* CONFIG_NFS_V4*/
183 /* how many bytes have been written/read and how many bytes queued up */
184 __u64 write_io;
185 __u64 read_io;
186#ifdef CONFIG_NFS_FSCACHE 204#ifdef CONFIG_NFS_FSCACHE
187 struct fscache_cookie *fscache; 205 struct fscache_cookie *fscache;
188#endif 206#endif
@@ -210,8 +228,8 @@ struct nfs_inode {
210#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 228#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
211#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 229#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
212#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 230#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
231#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */
213#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */ 232#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
214#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */
215 233
216static inline struct nfs_inode *NFS_I(const struct inode *inode) 234static inline struct nfs_inode *NFS_I(const struct inode *inode)
217{ 235{
@@ -243,6 +261,11 @@ static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
243 return NFS_SERVER(inode)->nfs_client->rpc_ops; 261 return NFS_SERVER(inode)->nfs_client->rpc_ops;
244} 262}
245 263
264static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
265{
266 return NFS_I(inode)->cookieverf;
267}
268
246static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode) 269static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
247{ 270{
248 struct nfs_server *nfss = NFS_SERVER(inode); 271 struct nfs_server *nfss = NFS_SERVER(inode);
@@ -291,6 +314,11 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
291 return NFS_SERVER(inode)->caps & cap; 314 return NFS_SERVER(inode)->caps & cap;
292} 315}
293 316
317static inline int NFS_USE_READDIRPLUS(struct inode *inode)
318{
319 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
320}
321
294static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 322static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
295{ 323{
296 dentry->d_time = verf; 324 dentry->d_time = verf;
@@ -333,8 +361,6 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
333extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 361extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
334extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 362extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
335extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 363extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
336extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
337extern void nfs_access_set_mask(struct nfs_access_entry *, u32);
338extern int nfs_permission(struct inode *, int); 364extern int nfs_permission(struct inode *, int);
339extern int nfs_open(struct inode *, struct file *); 365extern int nfs_open(struct inode *, struct file *);
340extern int nfs_release(struct inode *, struct file *); 366extern int nfs_release(struct inode *, struct file *);
@@ -347,7 +373,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
347extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
348extern void put_nfs_open_context(struct nfs_open_context *ctx); 374extern void put_nfs_open_context(struct nfs_open_context *ctx);
349extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
350extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); 376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode);
351extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
352extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
353extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -369,29 +395,6 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
369 kfree(fh); 395 kfree(fh);
370} 396}
371 397
372#ifdef NFS_DEBUG
373extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh);
374static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
375{
376 return _nfs_display_fhandle_hash(fh);
377}
378extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
379#define nfs_display_fhandle(fh, caption) \
380 do { \
381 if (unlikely(nfs_debug & NFSDBG_FACILITY)) \
382 _nfs_display_fhandle(fh, caption); \
383 } while (0)
384#else
385static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
386{
387 return 0;
388}
389static inline void nfs_display_fhandle(const struct nfs_fh *fh,
390 const char *caption)
391{
392}
393#endif
394
395/* 398/*
396 * linux/fs/nfs/nfsroot.c 399 * linux/fs/nfs/nfsroot.c
397 */ 400 */
@@ -402,8 +405,12 @@ extern __be32 root_nfs_parse_addr(char *name); /*__init*/
402/* 405/*
403 * linux/fs/nfs/file.c 406 * linux/fs/nfs/file.c
404 */ 407 */
408extern const struct inode_operations nfs_file_inode_operations;
409#ifdef CONFIG_NFS_V3
410extern const struct inode_operations nfs3_file_inode_operations;
411#endif /* CONFIG_NFS_V3 */
405extern const struct file_operations nfs_file_operations; 412extern const struct file_operations nfs_file_operations;
406#if IS_ENABLED(CONFIG_NFS_V4) 413#ifdef CONFIG_NFS_V4
407extern const struct file_operations nfs4_file_operations; 414extern const struct file_operations nfs4_file_operations;
408#endif /* CONFIG_NFS_V4 */ 415#endif /* CONFIG_NFS_V4 */
409extern const struct address_space_operations nfs_file_aops; 416extern const struct address_space_operations nfs_file_aops;
@@ -448,14 +455,18 @@ extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
448 unsigned long); 455 unsigned long);
449extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 456extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
450 const struct iovec *iov, unsigned long nr_segs, 457 const struct iovec *iov, unsigned long nr_segs,
451 loff_t pos, bool uio); 458 loff_t pos);
452extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 459extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
453 const struct iovec *iov, unsigned long nr_segs, 460 const struct iovec *iov, unsigned long nr_segs,
454 loff_t pos, bool uio); 461 loff_t pos);
455 462
456/* 463/*
457 * linux/fs/nfs/dir.c 464 * linux/fs/nfs/dir.c
458 */ 465 */
466extern const struct inode_operations nfs_dir_inode_operations;
467#ifdef CONFIG_NFS_V3
468extern const struct inode_operations nfs3_dir_inode_operations;
469#endif /* CONFIG_NFS_V3 */
459extern const struct file_operations nfs_dir_operations; 470extern const struct file_operations nfs_dir_operations;
460extern const struct dentry_operations nfs_dentry_operations; 471extern const struct dentry_operations nfs_dentry_operations;
461 472
@@ -513,10 +524,10 @@ extern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
513extern int nfs_wb_all(struct inode *inode); 524extern int nfs_wb_all(struct inode *inode);
514extern int nfs_wb_page(struct inode *inode, struct page* page); 525extern int nfs_wb_page(struct inode *inode, struct page* page);
515extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 526extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
516#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4) 527#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
517extern int nfs_commit_inode(struct inode *, int); 528extern int nfs_commit_inode(struct inode *, int);
518extern struct nfs_commit_data *nfs_commitdata_alloc(void); 529extern struct nfs_write_data *nfs_commitdata_alloc(void);
519extern void nfs_commit_free(struct nfs_commit_data *data); 530extern void nfs_commit_free(struct nfs_write_data *wdata);
520#else 531#else
521static inline int 532static inline int
522nfs_commit_inode(struct inode *inode, int how) 533nfs_commit_inode(struct inode *inode, int how)
@@ -532,6 +543,12 @@ nfs_have_writebacks(struct inode *inode)
532} 543}
533 544
534/* 545/*
546 * Allocate nfs_write_data structures
547 */
548extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages);
549extern void nfs_writedata_free(struct nfs_write_data *);
550
551/*
535 * linux/fs/nfs/read.c 552 * linux/fs/nfs/read.c
536 */ 553 */
537extern int nfs_readpage(struct file *, struct page *); 554extern int nfs_readpage(struct file *, struct page *);
@@ -542,6 +559,12 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
542 struct page *); 559 struct page *);
543 560
544/* 561/*
562 * Allocate nfs_read_data structures
563 */
564extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages);
565extern void nfs_readdata_free(struct nfs_read_data *);
566
567/*
545 * linux/fs/nfs3proc.c 568 * linux/fs/nfs3proc.c
546 */ 569 */
547#ifdef CONFIG_NFS_V3_ACL 570#ifdef CONFIG_NFS_V3_ACL
@@ -586,13 +609,43 @@ nfs_fileid_to_ino_t(u64 fileid)
586 609
587#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 610#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
588 611
612#endif /* __KERNEL__ */
613
614/*
615 * NFS debug flags
616 */
617#define NFSDBG_VFS 0x0001
618#define NFSDBG_DIRCACHE 0x0002
619#define NFSDBG_LOOKUPCACHE 0x0004
620#define NFSDBG_PAGECACHE 0x0008
621#define NFSDBG_PROC 0x0010
622#define NFSDBG_XDR 0x0020
623#define NFSDBG_FILE 0x0040
624#define NFSDBG_ROOT 0x0080
625#define NFSDBG_CALLBACK 0x0100
626#define NFSDBG_CLIENT 0x0200
627#define NFSDBG_MOUNT 0x0400
628#define NFSDBG_FSCACHE 0x0800
629#define NFSDBG_PNFS 0x1000
630#define NFSDBG_PNFS_LD 0x2000
631#define NFSDBG_ALL 0xFFFF
632
633#ifdef __KERNEL__
634
635/*
636 * Enable debugging support for nfs client.
637 * Requires RPC_DEBUG.
638 */
639#ifdef RPC_DEBUG
640# define NFS_DEBUG
641#endif
589 642
590# undef ifdebug 643# undef ifdebug
591# ifdef NFS_DEBUG 644# ifdef NFS_DEBUG
592# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 645# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))
593# define NFS_IFDEBUG(x) x
594# else 646# else
595# define ifdebug(fac) if (0) 647# define ifdebug(fac) if (0)
596# define NFS_IFDEBUG(x)
597# endif 648# endif
649#endif /* __KERNEL */
650
598#endif 651#endif