diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
| -rw-r--r-- | include/linux/nfs_fs.h | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 7e079f8ce18b..98c9b9f667a5 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #ifndef _LINUX_NFS_FS_H | 9 | #ifndef _LINUX_NFS_FS_H |
| 10 | #define _LINUX_NFS_FS_H | 10 | #define _LINUX_NFS_FS_H |
| 11 | 11 | ||
| 12 | #include <linux/magic.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * Enable debugging support for nfs client. | 15 | * Enable debugging support for nfs client. |
| @@ -23,16 +24,6 @@ | |||
| 23 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) | 24 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) |
| 24 | 25 | ||
| 25 | /* | 26 | /* |
| 26 | * superblock magic number for NFS | ||
| 27 | */ | ||
| 28 | #define NFS_SUPER_MAGIC 0x6969 | ||
| 29 | |||
| 30 | /* | ||
| 31 | * These are the default flags for swap requests | ||
| 32 | */ | ||
| 33 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) | ||
| 34 | |||
| 35 | /* | ||
| 36 | * When flushing a cluster of dirty pages, there can be different | 27 | * When flushing a cluster of dirty pages, there can be different |
| 37 | * strategies: | 28 | * strategies: |
| 38 | */ | 29 | */ |
| @@ -41,16 +32,17 @@ | |||
| 41 | #define FLUSH_LOWPRI 8 /* low priority background flush */ | 32 | #define FLUSH_LOWPRI 8 /* low priority background flush */ |
| 42 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ | 33 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ |
| 43 | #define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ | 34 | #define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ |
| 35 | #define FLUSH_INVALIDATE 64 /* Invalidate the page cache */ | ||
| 44 | 36 | ||
| 45 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
| 38 | |||
| 46 | #include <linux/in.h> | 39 | #include <linux/in.h> |
| 47 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
| 48 | #include <linux/pagemap.h> | 41 | #include <linux/pagemap.h> |
| 42 | #include <linux/rbtree.h> | ||
| 49 | #include <linux/rwsem.h> | 43 | #include <linux/rwsem.h> |
| 50 | #include <linux/wait.h> | 44 | #include <linux/wait.h> |
| 51 | 45 | ||
| 52 | #include <linux/nfs_fs_sb.h> | ||
| 53 | |||
| 54 | #include <linux/sunrpc/debug.h> | 46 | #include <linux/sunrpc/debug.h> |
| 55 | #include <linux/sunrpc/auth.h> | 47 | #include <linux/sunrpc/auth.h> |
| 56 | #include <linux/sunrpc/clnt.h> | 48 | #include <linux/sunrpc/clnt.h> |
| @@ -60,13 +52,23 @@ | |||
| 60 | #include <linux/nfs3.h> | 52 | #include <linux/nfs3.h> |
| 61 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
| 62 | #include <linux/nfs_xdr.h> | 54 | #include <linux/nfs_xdr.h> |
| 55 | |||
| 56 | #include <linux/nfs_fs_sb.h> | ||
| 57 | |||
| 63 | #include <linux/rwsem.h> | 58 | #include <linux/rwsem.h> |
| 64 | #include <linux/mempool.h> | 59 | #include <linux/mempool.h> |
| 65 | 60 | ||
| 66 | /* | 61 | /* |
| 62 | * These are the default flags for swap requests | ||
| 63 | */ | ||
| 64 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) | ||
| 65 | |||
| 66 | /* | ||
| 67 | * NFSv3/v4 Access mode cache entry | 67 | * NFSv3/v4 Access mode cache entry |
| 68 | */ | 68 | */ |
| 69 | struct nfs_access_entry { | 69 | struct nfs_access_entry { |
| 70 | struct rb_node rb_node; | ||
| 71 | struct list_head lru; | ||
| 70 | unsigned long jiffies; | 72 | unsigned long jiffies; |
| 71 | struct rpc_cred * cred; | 73 | struct rpc_cred * cred; |
| 72 | int mask; | 74 | int mask; |
| @@ -143,7 +145,9 @@ struct nfs_inode { | |||
| 143 | */ | 145 | */ |
| 144 | atomic_t data_updates; | 146 | atomic_t data_updates; |
| 145 | 147 | ||
| 146 | struct nfs_access_entry cache_access; | 148 | struct rb_root access_cache; |
| 149 | struct list_head access_cache_entry_lru; | ||
| 150 | struct list_head access_cache_inode_lru; | ||
| 147 | #ifdef CONFIG_NFS_V3_ACL | 151 | #ifdef CONFIG_NFS_V3_ACL |
| 148 | struct posix_acl *acl_access; | 152 | struct posix_acl *acl_access; |
| 149 | struct posix_acl *acl_default; | 153 | struct posix_acl *acl_default; |
| @@ -197,6 +201,7 @@ struct nfs_inode { | |||
| 197 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ | 201 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ |
| 198 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ | 202 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ |
| 199 | #define NFS_INO_STALE (2) /* possible stale inode */ | 203 | #define NFS_INO_STALE (2) /* possible stale inode */ |
| 204 | #define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ | ||
| 200 | 205 | ||
| 201 | static inline struct nfs_inode *NFS_I(struct inode *inode) | 206 | static inline struct nfs_inode *NFS_I(struct inode *inode) |
| 202 | { | 207 | { |
| @@ -207,8 +212,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) | |||
| 207 | #define NFS_FH(inode) (&NFS_I(inode)->fh) | 212 | #define NFS_FH(inode) (&NFS_I(inode)->fh) |
| 208 | #define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) | 213 | #define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) |
| 209 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) | 214 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) |
| 210 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) | 215 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) |
| 211 | #define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) | ||
| 212 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) | 216 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) |
| 213 | #define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) | 217 | #define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) |
| 214 | #define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) | 218 | #define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) |
| @@ -233,8 +237,12 @@ static inline int nfs_caches_unstable(struct inode *inode) | |||
| 233 | 237 | ||
| 234 | static inline void nfs_mark_for_revalidate(struct inode *inode) | 238 | static inline void nfs_mark_for_revalidate(struct inode *inode) |
| 235 | { | 239 | { |
| 240 | struct nfs_inode *nfsi = NFS_I(inode); | ||
| 241 | |||
| 236 | spin_lock(&inode->i_lock); | 242 | spin_lock(&inode->i_lock); |
| 237 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | 243 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; |
| 244 | if (S_ISDIR(inode->i_mode)) | ||
| 245 | nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; | ||
| 238 | spin_unlock(&inode->i_lock); | 246 | spin_unlock(&inode->i_lock); |
| 239 | } | 247 | } |
| 240 | 248 | ||
| @@ -291,12 +299,13 @@ extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | |||
| 291 | extern int nfs_permission(struct inode *, int, struct nameidata *); | 299 | extern int nfs_permission(struct inode *, int, struct nameidata *); |
| 292 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); | 300 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); |
| 293 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); | 301 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); |
| 302 | extern void nfs_access_zap_cache(struct inode *inode); | ||
| 294 | extern int nfs_open(struct inode *, struct file *); | 303 | extern int nfs_open(struct inode *, struct file *); |
| 295 | extern int nfs_release(struct inode *, struct file *); | 304 | extern int nfs_release(struct inode *, struct file *); |
| 296 | extern int nfs_attribute_timeout(struct inode *inode); | 305 | extern int nfs_attribute_timeout(struct inode *inode); |
| 297 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | 306 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); |
| 298 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 307 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
| 299 | extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 308 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
| 300 | extern int nfs_setattr(struct dentry *, struct iattr *); | 309 | extern int nfs_setattr(struct dentry *, struct iattr *); |
| 301 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 310 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); |
| 302 | extern void nfs_begin_attr_update(struct inode *); | 311 | extern void nfs_begin_attr_update(struct inode *); |
| @@ -324,7 +333,7 @@ extern struct inode_operations nfs_file_inode_operations; | |||
| 324 | extern struct inode_operations nfs3_file_inode_operations; | 333 | extern struct inode_operations nfs3_file_inode_operations; |
| 325 | #endif /* CONFIG_NFS_V3 */ | 334 | #endif /* CONFIG_NFS_V3 */ |
| 326 | extern const struct file_operations nfs_file_operations; | 335 | extern const struct file_operations nfs_file_operations; |
| 327 | extern struct address_space_operations nfs_file_aops; | 336 | extern const struct address_space_operations nfs_file_aops; |
| 328 | 337 | ||
| 329 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | 338 | static inline struct rpc_cred *nfs_file_cred(struct file *file) |
| 330 | { | 339 | { |
| @@ -392,6 +401,15 @@ extern void nfs_unregister_sysctl(void); | |||
| 392 | #endif | 401 | #endif |
| 393 | 402 | ||
| 394 | /* | 403 | /* |
| 404 | * linux/fs/nfs/namespace.c | ||
| 405 | */ | ||
| 406 | extern struct list_head nfs_automount_list; | ||
| 407 | extern struct inode_operations nfs_mountpoint_inode_operations; | ||
| 408 | extern struct inode_operations nfs_referral_inode_operations; | ||
| 409 | extern int nfs_mountpoint_expiry_timeout; | ||
| 410 | extern void nfs_release_automount_timer(void); | ||
| 411 | |||
| 412 | /* | ||
| 395 | * linux/fs/nfs/unlink.c | 413 | * linux/fs/nfs/unlink.c |
| 396 | */ | 414 | */ |
| 397 | extern int nfs_async_unlink(struct dentry *); | 415 | extern int nfs_async_unlink(struct dentry *); |
| @@ -408,7 +426,7 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | |||
| 408 | extern void nfs_writedata_release(void *); | 426 | extern void nfs_writedata_release(void *); |
| 409 | 427 | ||
| 410 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 428 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
| 411 | struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount); | 429 | struct nfs_write_data *nfs_commit_alloc(void); |
| 412 | void nfs_commit_free(struct nfs_write_data *p); | 430 | void nfs_commit_free(struct nfs_write_data *p); |
| 413 | #endif | 431 | #endif |
| 414 | 432 | ||
| @@ -457,10 +475,9 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
| 457 | } | 475 | } |
| 458 | 476 | ||
| 459 | /* | 477 | /* |
| 460 | * Allocate and free nfs_write_data structures | 478 | * Allocate nfs_write_data structures |
| 461 | */ | 479 | */ |
| 462 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); | 480 | extern struct nfs_write_data *nfs_writedata_alloc(size_t len); |
| 463 | extern void nfs_writedata_free(struct nfs_write_data *p); | ||
| 464 | 481 | ||
| 465 | /* | 482 | /* |
| 466 | * linux/fs/nfs/read.c | 483 | * linux/fs/nfs/read.c |
| @@ -472,10 +489,9 @@ extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); | |||
| 472 | extern void nfs_readdata_release(void *data); | 489 | extern void nfs_readdata_release(void *data); |
| 473 | 490 | ||
| 474 | /* | 491 | /* |
| 475 | * Allocate and free nfs_read_data structures | 492 | * Allocate nfs_read_data structures |
| 476 | */ | 493 | */ |
| 477 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); | 494 | extern struct nfs_read_data *nfs_readdata_alloc(size_t len); |
| 478 | extern void nfs_readdata_free(struct nfs_read_data *p); | ||
| 479 | 495 | ||
| 480 | /* | 496 | /* |
| 481 | * linux/fs/nfs3proc.c | 497 | * linux/fs/nfs3proc.c |
| @@ -562,6 +578,7 @@ extern void * nfs_root_data(void); | |||
| 562 | #define NFSDBG_FILE 0x0040 | 578 | #define NFSDBG_FILE 0x0040 |
| 563 | #define NFSDBG_ROOT 0x0080 | 579 | #define NFSDBG_ROOT 0x0080 |
| 564 | #define NFSDBG_CALLBACK 0x0100 | 580 | #define NFSDBG_CALLBACK 0x0100 |
| 581 | #define NFSDBG_CLIENT 0x0200 | ||
| 565 | #define NFSDBG_ALL 0xFFFF | 582 | #define NFSDBG_ALL 0xFFFF |
| 566 | 583 | ||
| 567 | #ifdef __KERNEL__ | 584 | #ifdef __KERNEL__ |
