nfs_fs.h revision 863a3c6c686d5773f7192a4818769e15db12ce08
11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/include/linux/nfs_fs.h 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 1992 Rick Sladkey 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * OS-specific nfs filesystem definitions and declarations 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _LINUX_NFS_FS_H 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _LINUX_NFS_FS_H 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 12e18fa700c9a31360bc8f193aa543b7ef7b39a06bJeff Garzik#include <linux/magic.h> 13e18fa700c9a31360bc8f193aa543b7ef7b39a06bJeff Garzik 1403bf4b707eee06706c9db343dd5c905b7ee47ed2Chuck Lever/* Default timeout values */ 15259875efed06d6936f54c9a264e868937f1bc217Trond Myklebust#define NFS_DEF_UDP_TIMEO (11) 16259875efed06d6936f54c9a264e868937f1bc217Trond Myklebust#define NFS_DEF_UDP_RETRANS (3) 17259875efed06d6936f54c9a264e868937f1bc217Trond Myklebust#define NFS_DEF_TCP_TIMEO (600) 18259875efed06d6936f54c9a264e868937f1bc217Trond Myklebust#define NFS_DEF_TCP_RETRANS (2) 19259875efed06d6936f54c9a264e868937f1bc217Trond Myklebust 2003bf4b707eee06706c9db343dd5c905b7ee47ed2Chuck Lever#define NFS_MAX_UDP_TIMEOUT (60*HZ) 2103bf4b707eee06706c9db343dd5c905b7ee47ed2Chuck Lever#define NFS_MAX_TCP_TIMEOUT (600*HZ) 2203bf4b707eee06706c9db343dd5c905b7ee47ed2Chuck Lever 230e0cab744b17a70ef0f08d818d66935feade7cadChuck Lever#define NFS_DEF_ACREGMIN (3) 240e0cab744b17a70ef0f08d818d66935feade7cadChuck Lever#define NFS_DEF_ACREGMAX (60) 250e0cab744b17a70ef0f08d818d66935feade7cadChuck Lever#define NFS_DEF_ACDIRMIN (30) 260e0cab744b17a70ef0f08d818d66935feade7cadChuck Lever#define NFS_DEF_ACDIRMAX (60) 270e0cab744b17a70ef0f08d818d66935feade7cadChuck Lever 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * When flushing a cluster of dirty pages, there can be different 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * strategies: 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FLUSH_SYNC 1 /* file being synced, or contention */ 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FLUSH_STABLE 4 /* commit to stable storage */ 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FLUSH_LOWPRI 8 /* low priority background flush */ 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 36b31268ac793fd300da66b9c28bbf0a200339ab96Trond Myklebust#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable 37b31268ac793fd300da66b9c28bbf0a200339ab96Trond Myklebust * if everything fits in one RPC */ 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef __KERNEL__ 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 417f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/in.h> 427f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/mm.h> 437f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/pagemap.h> 441c3c07e9f6cc50dab2aeb8051325e317d4f6c70eTrond Myklebust#include <linux/rbtree.h> 457f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/rwsem.h> 467f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/wait.h> 477f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse 487f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/sunrpc/debug.h> 497f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/sunrpc/auth.h> 507f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/sunrpc/clnt.h> 517f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse 527f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs.h> 537f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs2.h> 547f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs3.h> 557f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs4.h> 567f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs_xdr.h> 577f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/nfs_fs_sb.h> 587f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse 597f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#include <linux/mempool.h> 607f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse 617f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse/* 627f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse * These are the default flags for swap requests 637f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse */ 647f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) 657f1cbe51ffc1273bcded36742ede4b6ebef1b640David Woodhouse 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NFSv3/v4 Access mode cache entry 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct nfs_access_entry { 701c3c07e9f6cc50dab2aeb8051325e317d4f6c70eTrond Myklebust struct rb_node rb_node; 71cfcea3e8c66c2dcde98d5c2693d4bff50b5cac97Trond Myklebust struct list_head lru; 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long jiffies; 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct rpc_cred * cred; 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mask; 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 77f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebuststruct nfs_lock_context { 78f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust atomic_t count; 79f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust struct list_head list; 80f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust struct nfs_open_context *open_context; 81f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust fl_owner_t lockowner; 82f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust pid_t pid; 83f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust}; 84f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct nfs4_state; 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct nfs_open_context { 87f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebust struct nfs_lock_context lock_context; 8888be9f990fe70f0f177ef44a16a477599e91f825Trond Myklebust struct path path; 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct rpc_cred *cred; 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct nfs4_state *state; 91dc0b027dfadfcb8a5504f7d8052754bf8d501ab9Trond Myklebust fmode_t mode; 927b159fc18d417980f57aef64cab3417ee6af70f8Trond Myklebust 937b159fc18d417980f57aef64cab3417ee6af70f8Trond Myklebust unsigned long flags; 947b159fc18d417980f57aef64cab3417ee6af70f8Trond Myklebust#define NFS_CONTEXT_ERROR_WRITE (0) 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int error; 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head list; 98480c2006ebb44ae03165695db7b3e38c04e0d102Bryan Schumaker}; 9900a926422765064cb28e218d4837411c88bf6a3eOlivier Galibert 100480c2006ebb44ae03165695db7b3e38c04e0d102Bryan Schumakerstruct nfs_open_dir_context { 101480c2006ebb44ae03165695db7b3e38c04e0d102Bryan Schumaker struct rpc_cred *cred; 10200a926422765064cb28e218d4837411c88bf6a3eOlivier Galibert __u64 dir_cookie; 1038ef2ce3e16d9bec6cf015207c1c82a5b864046acBryan Schumaker __u64 dup_cookie; 1048ef2ce3e16d9bec6cf015207c1c82a5b864046acBryan Schumaker int duped; 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NFSv4 delegation 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct nfs_delegation; 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1125c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacherstruct posix_acl; 1135c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * nfs fs inode data in memory 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct nfs_inode { 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * The 64bit 'inode number' 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds __u64 fileid; 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NFS file handle 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct nfs_fh fh; 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Various flags 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 131412d582ec1dd59aab2353f8cb7e74f2c79cd20b9Chuck Lever unsigned long flags; /* atomic bit ops */ 132412d582ec1dd59aab2353f8cb7e74f2c79cd20b9Chuck Lever unsigned long cache_validity; /* bit mask */ 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 13524bd68f46b1ad08d69bf32779f860df867780a7aGoldwyn Rodrigues * read_cache_jiffies is when we started read-caching this inode. 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * attrtimeo is for how long the cached information is assumed 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * to be valid. A successful attribute revalidation doubles 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * attrtimeo (up to acregmax/acdirmax), a failure resets it to 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * acregmin/acdirmin. 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * We need to revalidate the cached attrs for this inode if 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 14364672d55d93c26fb4035fd1a84a803cbc09cb058Peter Staubach * jiffies - read_cache_jiffies >= attrtimeo 14464672d55d93c26fb4035fd1a84a803cbc09cb058Peter Staubach * 14564672d55d93c26fb4035fd1a84a803cbc09cb058Peter Staubach * Please note the comparison is greater than or equal 14664672d55d93c26fb4035fd1a84a803cbc09cb058Peter Staubach * so that zero timeout values can be specified. 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long read_cache_jiffies; 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long attrtimeo; 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long attrtimeo_timestamp; 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds __u64 change_attr; /* v4 only */ 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1534704f0e274829e3af00737d2d9adace2d71a9605Trond Myklebust unsigned long attr_gencount; 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* "Generation counter" for the attribute cache. This is 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * bumped whenever we update the metadata on the 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * server. 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long cache_change_attribute; 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1601c3c07e9f6cc50dab2aeb8051325e317d4f6c70eTrond Myklebust struct rb_root access_cache; 161cfcea3e8c66c2dcde98d5c2693d4bff50b5cac97Trond Myklebust struct list_head access_cache_entry_lru; 162cfcea3e8c66c2dcde98d5c2693d4bff50b5cac97Trond Myklebust struct list_head access_cache_inode_lru; 1635c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher#ifdef CONFIG_NFS_V3_ACL 1645c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher struct posix_acl *acl_access; 1655c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher struct posix_acl *acl_default; 1665c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher#endif 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This is the cookie verifier used for NFSv3 readdir 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * operations 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 172bc4785cd475a11ba125df7af674e16c6ea1cfc30Al Viro __be32 cookieverf[2]; 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This is the list of dirty unwritten pages. 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct radix_tree_root nfs_page_tree; 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 179fb8a1f11b64e213d94dfa1cebb2a42a7b8c115c4Trond Myklebust unsigned long npages; 180ff778d02bf867e1733a09b34ad6dbb723b024814Trond Myklebust unsigned long ncommit; 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Open contexts for shared mmap writes */ 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head open_files; 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 185565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust /* Number of in-flight sillydelete RPC calls */ 186565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust atomic_t silly_count; 187565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust /* List of deferred sillydelete requests */ 188565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust struct hlist_head silly_list; 189565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust wait_queue_head_t waitqueue; 190565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebust 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_NFS_V4 192e50a1c2e1f816c81eed6a589019052cb44189267J. Bruce Fields struct nfs4_cached_acl *nfs4_acl; 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* NFSv4 state */ 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head open_states; 1955b22216e11f717adc344abc7f97b42e03127c6c0Arnd Bergmann struct nfs_delegation __rcu *delegation; 196bd7bf9d540c001055fba796ebf146d90e4dd2eb2Trond Myklebust fmode_t delegation_state; 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct rw_semaphore rwsem; 198e5e940170b2136ad4d5483ef293ae284b9cc8d53Benny Halevy 199e5e940170b2136ad4d5483ef293ae284b9cc8d53Benny Halevy /* pNFS layout information */ 200e5e940170b2136ad4d5483ef293ae284b9cc8d53Benny Halevy struct pnfs_layout_hdr *layout; 201e0c2b3801828aadb65dec9f67f7c6b7a675ad007Fred Isaman atomic_t commits_outstanding; 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* CONFIG_NFS_V4*/ 203ef79c097bbe9724e13937271b3457df560e00370David Howells#ifdef CONFIG_NFS_FSCACHE 204ef79c097bbe9724e13937271b3457df560e00370David Howells struct fscache_cookie *fscache; 205ef79c097bbe9724e13937271b3457df560e00370David Howells#endif 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct inode vfs_inode; 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 2105529680981807b44abf3be30fb6d612ff04f68ffChuck Lever * Cache validity bit flags 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 2125529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */ 2135529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */ 2145529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */ 2155529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */ 2165529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ 2175529680981807b44abf3be30fb6d612ff04f68ffChuck Lever#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 218412c77cee6d6e73fbe1dc3d67f52163efed33fc4Trond Myklebust#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ 2195529680981807b44abf3be30fb6d612ff04f68ffChuck Lever 2205529680981807b44abf3be30fb6d612ff04f68ffChuck Lever/* 221412d582ec1dd59aab2353f8cb7e74f2c79cd20b9Chuck Lever * Bit offsets in flags field 2225529680981807b44abf3be30fb6d612ff04f68ffChuck Lever */ 223691beb13cdc88358334ef0ba867c080a247a760fTrond Myklebust#define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */ 224691beb13cdc88358334ef0ba867c080a247a760fTrond Myklebust#define NFS_INO_STALE (1) /* possible stale inode */ 225691beb13cdc88358334ef0ba867c080a247a760fTrond Myklebust#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */ 22672cb77f4a5ace37b12dcb47a0e8637a2c28ad881Trond Myklebust#define NFS_INO_FLUSHING (4) /* inode is flushing out data */ 227ef79c097bbe9724e13937271b3457df560e00370David Howells#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 228ef79c097bbe9724e13937271b3457df560e00370David Howells#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 22971d0a6112a363e703e383ae5b12c492485c39701Trond Myklebust#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 230a861a1e1c398fe34701569fd8ac9225dfe0a9a7eFred Isaman#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */ 231863a3c6c686d5773f7192a4818769e15db12ce08Andy Adamson#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */ 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 23399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline struct nfs_inode *NFS_I(const struct inode *inode) 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return container_of(inode, struct nfs_inode, vfs_inode); 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 23799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 23899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline struct nfs_server *NFS_SB(const struct super_block *s) 23999fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 24099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return (struct nfs_server *)(s->s_fs_info); 24199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 24299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 24399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline struct nfs_fh *NFS_FH(const struct inode *inode) 24499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 24599fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return &NFS_I(inode)->fh; 24699fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 24799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 24899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline struct nfs_server *NFS_SERVER(const struct inode *inode) 24999fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 25099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return NFS_SB(inode->i_sb); 25199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 25299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 25399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode) 25499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 25599fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return NFS_SERVER(inode)->client; 25699fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 25799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 25899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode) 25999fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 26099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return NFS_SERVER(inode)->nfs_client->rpc_ops; 26199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 26299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 26399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline __be32 *NFS_COOKIEVERF(const struct inode *inode) 26499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 26599fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return NFS_I(inode)->cookieverf; 26699fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 26799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 26899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline unsigned NFS_MINATTRTIMEO(const struct inode *inode) 26999fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 27099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy struct nfs_server *nfss = NFS_SERVER(inode); 27199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin; 27299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 27399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 27499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode) 27599fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 27699fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy struct nfs_server *nfss = NFS_SERVER(inode); 27799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax; 27899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 27999fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 28099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline int NFS_STALE(const struct inode *inode) 28199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 28299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 28399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 28499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 285ef79c097bbe9724e13937271b3457df560e00370David Howellsstatic inline int NFS_FSCACHE(const struct inode *inode) 286ef79c097bbe9724e13937271b3457df560e00370David Howells{ 287ef79c097bbe9724e13937271b3457df560e00370David Howells return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); 288ef79c097bbe9724e13937271b3457df560e00370David Howells} 289ef79c097bbe9724e13937271b3457df560e00370David Howells 29099fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline __u64 NFS_FILEID(const struct inode *inode) 29199fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 29299fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy return NFS_I(inode)->fileid; 29399fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 29499fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy 29599fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevystatic inline void set_nfs_fileid(struct inode *inode, __u64 fileid) 29699fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy{ 29799fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy NFS_I(inode)->fileid = fileid; 29899fadcd76465842c014c88b8c9c19b457e9debc0Benny Halevy} 2991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 300decf491f3076190262d4c649bed877650623903aTrond Myklebuststatic inline void nfs_mark_for_revalidate(struct inode *inode) 301decf491f3076190262d4c649bed877650623903aTrond Myklebust{ 30238478b24e37587f1c4fedf8ac070ca54f052ed28Trond Myklebust struct nfs_inode *nfsi = NFS_I(inode); 30338478b24e37587f1c4fedf8ac070ca54f052ed28Trond Myklebust 304decf491f3076190262d4c649bed877650623903aTrond Myklebust spin_lock(&inode->i_lock); 30538478b24e37587f1c4fedf8ac070ca54f052ed28Trond Myklebust nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; 306f38211100d4823be530577dc3452f838861222ecTrond Myklebust if (S_ISDIR(inode->i_mode)) 30738478b24e37587f1c4fedf8ac070ca54f052ed28Trond Myklebust nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; 308decf491f3076190262d4c649bed877650623903aTrond Myklebust spin_unlock(&inode->i_lock); 309decf491f3076190262d4c649bed877650623903aTrond Myklebust} 310decf491f3076190262d4c649bed877650623903aTrond Myklebust 3111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline int nfs_server_capable(struct inode *inode, int cap) 3121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 3131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NFS_SERVER(inode)->caps & cap; 3141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 3151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline int NFS_USE_READDIRPLUS(struct inode *inode) 3171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 3183a10c30acc4821ca000b52ed0edafd0d3bf26a52Benny Halevy return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags); 3191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 3201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 321d75340cc4de5c187fbf0bba234309ca86cf0a2fbTrond Myklebuststatic inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 322d75340cc4de5c187fbf0bba234309ca86cf0a2fbTrond Myklebust{ 323d75340cc4de5c187fbf0bba234309ca86cf0a2fbTrond Myklebust dentry->d_time = verf; 324d75340cc4de5c187fbf0bba234309ca86cf0a2fbTrond Myklebust} 325d75340cc4de5c187fbf0bba234309ca86cf0a2fbTrond Myklebust 3261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/** 3271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * nfs_save_change_attribute - Returns the inode attribute change cookie 3288edb01828837302055a8f0afddb2256659480bc5Trond Myklebust * @dir - pointer to parent directory inode 3291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * The "change attribute" is updated every time we finish an operation 3301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * that will result in a metadata change on the server. 3311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 3328edb01828837302055a8f0afddb2256659480bc5Trond Myklebuststatic inline unsigned long nfs_save_change_attribute(struct inode *dir) 3331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 3348edb01828837302055a8f0afddb2256659480bc5Trond Myklebust return NFS_I(dir)->cache_change_attribute; 3351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 3361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/** 3384b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust * nfs_verify_change_attribute - Detects NFS remote directory changes 3394b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust * @dir - pointer to parent directory inode 3401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @chattr - previously saved change attribute 3414b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust * Return "false" if the verifiers doesn't match the change attribute. 3424b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust * This would usually indicate that the directory contents have changed on 3434b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust * the server, and that any dentries need revalidating. 3441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 3454b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebuststatic inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr) 3461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 3474b841736bc16b320bcdb1e8ece585b3ced9a8811Trond Myklebust return chattr == NFS_I(dir)->cache_change_attribute; 3481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 3491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 3511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/inode.c 3521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 35329884df0d89c1df0dec3449405bc41569bb44800Trond Myklebustextern int nfs_sync_mapping(struct address_space *mapping); 354cd9ae2b6a75bb1fa0d370929c2d7a7da1ed719d9Trond Myklebustextern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); 3551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void nfs_zap_caches(struct inode *); 356c4812998398d9cbce8646494704c52297359ede0Trond Myklebustextern void nfs_invalidate_atime(struct inode *); 3571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 3581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct nfs_fattr *); 3591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 360decf491f3076190262d4c649bed877650623903aTrond Myklebustextern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 36170ca88521fc7bee8ef0fc22033a439d4b9a2c70dTrond Myklebustextern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 3621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 363b74c79e99389cd79b31fcc08f82c24e492e63c7eNick Pigginextern int nfs_permission(struct inode *, int, unsigned int); 3641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_open(struct inode *, struct file *); 3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_release(struct inode *, struct file *); 3661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_attribute_timeout(struct inode *inode); 3671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 3681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 36944b11874ff583b6e766a05856b04f3c492c32b84Trond Myklebustextern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 3701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_setattr(struct dentry *, struct iattr *); 37165e4308d2500e7daf60c3dccc202c61ffb066c63Trond Myklebustextern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 3721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 3731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void put_nfs_open_context(struct nfs_open_context *ctx); 374dc0b027dfadfcb8a5504f7d8052754bf8d501ab9Trond Myklebustextern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375cd9a1c0e5ac681871d64804f82291649e2a0accbTrond Myklebustextern struct nfs_open_context *alloc_nfs_open_context(struct path *path, struct rpc_cred *cred, fmode_t f_mode); 376cd9a1c0e5ac681871d64804f82291649e2a0accbTrond Myklebustextern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebustextern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378f11ac8db5d07b6e99d41ff4aa39d878ee5cef1c5Trond Myklebustextern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379f43bf0bebed7c33b698a8a25f95812f9e87c3843Trond Myklebustextern u64 nfs_compat_user_ino64(u64 fileid); 3804704f0e274829e3af00737d2d9adace2d71a9605Trond Myklebustextern void nfs_fattr_init(struct nfs_fattr *fattr); 38156463e50d1fc3f070492434cea6303b35ea000deChuck Leverextern unsigned long nfs_inc_attr_generation_counter(void); 3821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3832d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebustextern struct nfs_fattr *nfs_alloc_fattr(void); 3842d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust 3852d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebuststatic inline void nfs_free_fattr(const struct nfs_fattr *fattr) 3862d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust{ 3872d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust kfree(fattr); 3882d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust} 3892d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust 3902d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebustextern struct nfs_fh *nfs_alloc_fhandle(void); 3912d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust 3922d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebuststatic inline void nfs_free_fhandle(const struct nfs_fh *fh) 3932d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust{ 3942d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust kfree(fh); 3952d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust} 3962d36bfde8565b315e624302d12da5a7c9d195522Trond Myklebust 39756463e50d1fc3f070492434cea6303b35ea000deChuck Lever/* 39856463e50d1fc3f070492434cea6303b35ea000deChuck Lever * linux/fs/nfs/nfsroot.c 39956463e50d1fc3f070492434cea6303b35ea000deChuck Lever */ 40056463e50d1fc3f070492434cea6303b35ea000deChuck Leverextern int nfs_root_data(char **root_device, char **root_data); /*__init*/ 4011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 4025a874db4d9bfd8a4c6324d844a4d1c7cfa5cf2c4Al Viroextern __be32 root_nfs_parse_addr(char *name); /*__init*/ 4030e574af1be5f569a5d7f2800333b0bfb358a5e34Trond Myklebust 4041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 4051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/file.c 4061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 407c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs_file_inode_operations; 408b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#ifdef CONFIG_NFS_V3 409c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs3_file_inode_operations; 410b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#endif /* CONFIG_NFS_V3 */ 4114b6f5d20b04dcbc3d888555522b90ba6d36c4106Arjan van de Venextern const struct file_operations nfs_file_operations; 412f5e54d6e53a20cef45af7499e86164f0e0d16bb2Christoph Hellwigextern const struct address_space_operations nfs_file_aops; 41311de3b11e08cac26d59e88efaf4e316701883552Trond Myklebustextern const struct address_space_operations nfs_dir_aops; 4141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 415c03025d55540bd648f2546659090140ecc835572Trond Myklebuststatic inline struct nfs_open_context *nfs_file_open_context(struct file *filp) 416c03025d55540bd648f2546659090140ecc835572Trond Myklebust{ 417c03025d55540bd648f2546659090140ecc835572Trond Myklebust return filp->private_data; 418c03025d55540bd648f2546659090140ecc835572Trond Myklebust} 419c03025d55540bd648f2546659090140ecc835572Trond Myklebust 4201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline struct rpc_cred *nfs_file_cred(struct file *file) 4211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 422504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown if (file != NULL) { 423504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown struct nfs_open_context *ctx = 424504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown nfs_file_open_context(file); 425504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown if (ctx) 426504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown return ctx->cred; 427504e518953a330c8d44a95bdd65a5c9f50f1012eNeil Brown } 4281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NULL; 4291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 4301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 432b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher * linux/fs/nfs/xattr.c 433b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher */ 434b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#ifdef CONFIG_NFS_V3_ACL 435b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern ssize_t nfs3_listxattr(struct dentry *, char *, size_t); 436b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t); 437b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern int nfs3_setxattr(struct dentry *, const char *, 438b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher const void *, size_t, int); 439b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern int nfs3_removexattr (struct dentry *, const char *name); 440b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#else 441b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher# define nfs3_listxattr NULL 442b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher# define nfs3_getxattr NULL 443b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher# define nfs3_setxattr NULL 444b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher# define nfs3_removexattr NULL 445b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#endif 446b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher 447b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher/* 4481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/direct.c 4491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 4501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 4511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long); 452027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavartyextern ssize_t nfs_file_direct_read(struct kiocb *iocb, 453027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavarty const struct iovec *iov, unsigned long nr_segs, 454027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavarty loff_t pos); 455027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavartyextern ssize_t nfs_file_direct_write(struct kiocb *iocb, 456027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavarty const struct iovec *iov, unsigned long nr_segs, 457027445c37282bc1ed26add45e573ad2d3e4860a5Badari Pulavarty loff_t pos); 4581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 4601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/dir.c 4611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 462c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs_dir_inode_operations; 463b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#ifdef CONFIG_NFS_V3 464c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs3_dir_inode_operations; 465b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#endif /* CONFIG_NFS_V3 */ 4664b6f5d20b04dcbc3d888555522b90ba6d36c4106Arjan van de Venextern const struct file_operations nfs_dir_operations; 467f786aa90e026f2174bb0c26d49f338c5c46ede55Al Viroextern const struct dentry_operations nfs_dentry_operations; 4681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 469bfc69a456642a51c89dfd8e5184468857cb44f32Trond Myklebustextern void nfs_force_lookup_revalidate(struct inode *dir); 4701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 471af22f94ae02ab9dd4fd7fe628c8434a59cc293beTrond Myklebustextern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 472af22f94ae02ab9dd4fd7fe628c8434a59cc293beTrond Myklebustextern void nfs_access_zap_cache(struct inode *inode); 4731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 4751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/symlink.c 4761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 477c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs_symlink_inode_operations; 4781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 480a72b44222d222749d54b3e370d825094352e389fTrond Myklebust * linux/fs/nfs/sysctl.c 481a72b44222d222749d54b3e370d825094352e389fTrond Myklebust */ 482a72b44222d222749d54b3e370d825094352e389fTrond Myklebust#ifdef CONFIG_SYSCTL 483a72b44222d222749d54b3e370d825094352e389fTrond Myklebustextern int nfs_register_sysctl(void); 484a72b44222d222749d54b3e370d825094352e389fTrond Myklebustextern void nfs_unregister_sysctl(void); 485a72b44222d222749d54b3e370d825094352e389fTrond Myklebust#else 4867fd105e758c8d746d57ab7e77f100e096bf153c8Stephen Rothwell#define nfs_register_sysctl() 0 487a72b44222d222749d54b3e370d825094352e389fTrond Myklebust#define nfs_unregister_sysctl() do { } while(0) 488a72b44222d222749d54b3e370d825094352e389fTrond Myklebust#endif 489a72b44222d222749d54b3e370d825094352e389fTrond Myklebust 490a72b44222d222749d54b3e370d825094352e389fTrond Myklebust/* 49155a975937d40cac582e981ddc8ed783b3dcc043cTrond Myklebust * linux/fs/nfs/namespace.c 49255a975937d40cac582e981ddc8ed783b3dcc043cTrond Myklebust */ 493c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs_mountpoint_inode_operations; 494c5ef1c42c51b1b5b4a401a6517bdda30933ddbafArjan van de Venextern const struct inode_operations nfs_referral_inode_operations; 49551d8fa6a109589d522c18a8e9bf3fb167a91b1bcTrond Myklebustextern int nfs_mountpoint_expiry_timeout; 49651d8fa6a109589d522c18a8e9bf3fb167a91b1bcTrond Myklebustextern void nfs_release_automount_timer(void); 49755a975937d40cac582e981ddc8ed783b3dcc043cTrond Myklebust 49855a975937d40cac582e981ddc8ed783b3dcc043cTrond Myklebust/* 4991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/unlink.c 5001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 501e4eff1a622edd6ab7b73acd5d8763aa2fa3fee49Trond Myklebustextern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 502565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebustextern void nfs_block_sillyrename(struct dentry *dentry); 503565277f63c616e11c37309a1e98c052d18ebbb55Trond Myklebustextern void nfs_unblock_sillyrename(struct dentry *dentry); 504779c51795bfb35c2403c924b9de90ca9356bc693Jeff Laytonextern int nfs_sillyrename(struct inode *dir, struct dentry *dentry); 5051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 5071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/write.c 5081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 50989a09141df6ac1c3821fbe44ca8384eb37692965Peter Zijlstraextern int nfs_congestion_kb; 5101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_writepage(struct page *page, struct writeback_control *wbc); 5111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_writepages(struct address_space *, struct writeback_control *); 5121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_flush_incompatible(struct file *file, struct page *page); 5131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 514136028967a283929c6f01518d0700b73fa622d56Fred Isamanextern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 5151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 5171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Try to write back everything synchronously (but check the 5181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * return value!) 5191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 5201c75950b9a2254ef08f986e00ad20266ae9ba7f1Trond Myklebustextern int nfs_wb_all(struct inode *inode); 5211c75950b9a2254ef08f986e00ad20266ae9ba7f1Trond Myklebustextern int nfs_wb_page(struct inode *inode, struct page* page); 5221b3b4a1a2deb7d3e5d66063bd76304d840c966b3Trond Myklebustextern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 5231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 524b608b283a962caaa280756bc8563016a71712acfTrond Myklebustextern int nfs_commit_inode(struct inode *, int); 525c9d8f89d9816c1d16ada492aa547a4d692508c0dTrond Myklebustextern struct nfs_write_data *nfs_commitdata_alloc(void); 5268aca67f0ae2d8811165c22326825a645cc8e1b48Trond Myklebustextern void nfs_commit_free(struct nfs_write_data *wdata); 52777a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebust#else 52877a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebuststatic inline int 52977a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebustnfs_commit_inode(struct inode *inode, int how) 53077a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebust{ 53177a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebust return 0; 53277a63f3d1e0a3e7ede8d10f569e8481b13ff47c5Trond Myklebust} 5331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 5341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline int 5361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsnfs_have_writebacks(struct inode *inode) 5371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 5381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NFS_I(inode)->npages != 0; 5391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 5401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 542e4e20512cfe0bacec0764b4925889d1fa94644f9Adrian Bunk * Allocate nfs_write_data structures 5431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 5448d5658c949e6d89edc579a1f112aeee3bc232a8eTrond Myklebustextern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); 5451ae88b2e446261c038f2c0c3150ffae142b227a2Trond Myklebustextern void nfs_writedata_free(struct nfs_write_data *); 5461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 5481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linux/fs/nfs/read.c 5491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 5501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_readpage(struct file *, struct page *); 5511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int nfs_readpages(struct file *, struct address_space *, 5521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head *, unsigned); 553ec06c096edec0755534c7126f4caded69de131c2Trond Myklebustextern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); 554f42b293d6d5259043a8944b556eeab427c695d57David Howellsextern int nfs_readpage_async(struct nfs_open_context *, struct inode *, 555f42b293d6d5259043a8944b556eeab427c695d57David Howells struct page *); 556963d8fe53339128ee46a7701f2e36305f0ccff8cTrond Myklebust 5571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 558e4e20512cfe0bacec0764b4925889d1fa94644f9Adrian Bunk * Allocate nfs_read_data structures 5591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 5608d5658c949e6d89edc579a1f112aeee3bc232a8eTrond Myklebustextern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); 5611ae88b2e446261c038f2c0c3150ffae142b227a2Trond Myklebustextern void nfs_readdata_free(struct nfs_read_data *); 5621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 564b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher * linux/fs/nfs3proc.c 565b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher */ 566b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#ifdef CONFIG_NFS_V3_ACL 567b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type); 568b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacherextern int nfs3_proc_setacl(struct inode *inode, int type, 569b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher struct posix_acl *acl); 570055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacherextern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode, 571055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher mode_t mode); 5725c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacherextern void nfs3_forget_cached_acls(struct inode *inode); 573055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher#else 574055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacherstatic inline int nfs3_proc_set_default_acl(struct inode *dir, 575055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher struct inode *inode, 576055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher mode_t mode) 577055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher{ 578055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher return 0; 579055ffbea0596942579b0dae71d5dab78de8135f6Andreas Gruenbacher} 5805c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher 5815c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacherstatic inline void nfs3_forget_cached_acls(struct inode *inode) 5825c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher{ 5835c6a9f7d92291c832d47e792ed1fafa44acb066eAndreas Gruenbacher} 584b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher#endif /* CONFIG_NFS_V3_ACL */ 585b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher 586b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704Andreas Gruenbacher/* 5871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * inline functions 5881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 5891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 590433c92379d9c2c59c2ebc7628fe4fb02cfc2daf8Chuck Leverstatic inline loff_t nfs_size_to_loff_t(__u64 size) 5911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 592433c92379d9c2c59c2ebc7628fe4fb02cfc2daf8Chuck Lever if (size > (__u64) OFFSET_MAX - 1) 593433c92379d9c2c59c2ebc7628fe4fb02cfc2daf8Chuck Lever return OFFSET_MAX - 1; 5941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (loff_t) size; 5951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 5961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline ino_t 5981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsnfs_fileid_to_ino_t(u64 fileid) 5991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 6001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ino_t ino = (ino_t) fileid; 6011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (sizeof(ino_t) < sizeof(u64)) 6021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; 6031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return ino; 6041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 6051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 6071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* __KERNEL__ */ 6091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 6111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NFS debug flags 6121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 6131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_VFS 0x0001 6141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_DIRCACHE 0x0002 6151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_LOOKUPCACHE 0x0004 6161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_PAGECACHE 0x0008 6171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_PROC 0x0010 6181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_XDR 0x0020 6191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_FILE 0x0040 6201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_ROOT 0x0080 6211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_CALLBACK 0x0100 62224c8dbbb5f777187d660393599641ab3307b4b97David Howells#define NFSDBG_CLIENT 0x0200 623f18289931d705f9c4634b361341a1677bea97acaChuck Lever#define NFSDBG_MOUNT 0x0400 624c6a6f19e22da0a3d74214ee010224c9a30a794c1David Howells#define NFSDBG_FSCACHE 0x0800 62585e174ba6b786ad336eb2df105b4f66d0932e70aRicardo Labiaga#define NFSDBG_PNFS 0x1000 6267ab672ce312133ee4a5d85b71447b2b334403681Dean Hildebrand#define NFSDBG_PNFS_LD 0x2000 6271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NFSDBG_ALL 0xFFFF 6281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef __KERNEL__ 6304dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy 6314dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy/* 6324dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy * Enable debugging support for nfs client. 6334dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy * Requires RPC_DEBUG. 6344dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy */ 6354dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy#ifdef RPC_DEBUG 6364dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy# define NFS_DEBUG 6374dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy#endif 6384dc2eaecd4cf0687727e418540bccf956a62ebcfBenny Halevy 6391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# undef ifdebug 6401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# ifdef NFS_DEBUG 6411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 6421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# else 6431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define ifdebug(fac) if (0) 6441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# endif 6451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* __KERNEL */ 6461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 648