diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nfs_fs.h | 241 |
1 files changed, 0 insertions, 241 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index dbac7f363e5d..fb33e7655cfa 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/rwsem.h> | 16 | #include <linux/rwsem.h> |
17 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
18 | #include <linux/uio.h> | ||
19 | 18 | ||
20 | #include <linux/nfs_fs_sb.h> | 19 | #include <linux/nfs_fs_sb.h> |
21 | 20 | ||
@@ -29,7 +28,6 @@ | |||
29 | #include <linux/nfs4.h> | 28 | #include <linux/nfs4.h> |
30 | #include <linux/nfs_xdr.h> | 29 | #include <linux/nfs_xdr.h> |
31 | #include <linux/rwsem.h> | 30 | #include <linux/rwsem.h> |
32 | #include <linux/workqueue.h> | ||
33 | #include <linux/mempool.h> | 31 | #include <linux/mempool.h> |
34 | 32 | ||
35 | /* | 33 | /* |
@@ -44,13 +42,6 @@ | |||
44 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 | 42 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 |
45 | 43 | ||
46 | /* | 44 | /* |
47 | * The upper limit on timeouts for the exponential backoff algorithm. | ||
48 | */ | ||
49 | #define NFS_WRITEBACK_DELAY (5*HZ) | ||
50 | #define NFS_WRITEBACK_LOCKDELAY (60*HZ) | ||
51 | #define NFS_COMMIT_DELAY (5*HZ) | ||
52 | |||
53 | /* | ||
54 | * superblock magic number for NFS | 45 | * superblock magic number for NFS |
55 | */ | 46 | */ |
56 | #define NFS_SUPER_MAGIC 0x6969 | 47 | #define NFS_SUPER_MAGIC 0x6969 |
@@ -60,9 +51,6 @@ | |||
60 | */ | 51 | */ |
61 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) | 52 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) |
62 | 53 | ||
63 | #define NFS_RW_SYNC 0x0001 /* O_SYNC handling */ | ||
64 | #define NFS_RW_SWAP 0x0002 /* This is a swap request */ | ||
65 | |||
66 | /* | 54 | /* |
67 | * When flushing a cluster of dirty pages, there can be different | 55 | * When flushing a cluster of dirty pages, there can be different |
68 | * strategies: | 56 | * strategies: |
@@ -434,11 +422,6 @@ static inline void nfs_writedata_free(struct nfs_write_data *p) | |||
434 | mempool_free(p, nfs_wdata_mempool); | 422 | mempool_free(p, nfs_wdata_mempool); |
435 | } | 423 | } |
436 | 424 | ||
437 | /* Hack for future NFS swap support */ | ||
438 | #ifndef IS_SWAPFILE | ||
439 | # define IS_SWAPFILE(inode) (0) | ||
440 | #endif | ||
441 | |||
442 | /* | 425 | /* |
443 | * linux/fs/nfs/read.c | 426 | * linux/fs/nfs/read.c |
444 | */ | 427 | */ |
@@ -515,230 +498,6 @@ extern void * nfs_root_data(void); | |||
515 | 498 | ||
516 | #define NFS_JUKEBOX_RETRY_TIME (5 * HZ) | 499 | #define NFS_JUKEBOX_RETRY_TIME (5 * HZ) |
517 | 500 | ||
518 | #ifdef CONFIG_NFS_V4 | ||
519 | |||
520 | struct idmap; | ||
521 | |||
522 | /* | ||
523 | * In a seqid-mutating op, this macro controls which error return | ||
524 | * values trigger incrementation of the seqid. | ||
525 | * | ||
526 | * from rfc 3010: | ||
527 | * The client MUST monotonically increment the sequence number for the | ||
528 | * CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE | ||
529 | * operations. This is true even in the event that the previous | ||
530 | * operation that used the sequence number received an error. The only | ||
531 | * exception to this rule is if the previous operation received one of | ||
532 | * the following errors: NFSERR_STALE_CLIENTID, NFSERR_STALE_STATEID, | ||
533 | * NFSERR_BAD_STATEID, NFSERR_BAD_SEQID, NFSERR_BADXDR, | ||
534 | * NFSERR_RESOURCE, NFSERR_NOFILEHANDLE. | ||
535 | * | ||
536 | */ | ||
537 | #define seqid_mutating_err(err) \ | ||
538 | (((err) != NFSERR_STALE_CLIENTID) && \ | ||
539 | ((err) != NFSERR_STALE_STATEID) && \ | ||
540 | ((err) != NFSERR_BAD_STATEID) && \ | ||
541 | ((err) != NFSERR_BAD_SEQID) && \ | ||
542 | ((err) != NFSERR_BAD_XDR) && \ | ||
543 | ((err) != NFSERR_RESOURCE) && \ | ||
544 | ((err) != NFSERR_NOFILEHANDLE)) | ||
545 | |||
546 | enum nfs4_client_state { | ||
547 | NFS4CLNT_OK = 0, | ||
548 | }; | ||
549 | |||
550 | /* | ||
551 | * The nfs4_client identifies our client state to the server. | ||
552 | */ | ||
553 | struct nfs4_client { | ||
554 | struct list_head cl_servers; /* Global list of servers */ | ||
555 | struct in_addr cl_addr; /* Server identifier */ | ||
556 | u64 cl_clientid; /* constant */ | ||
557 | nfs4_verifier cl_confirm; | ||
558 | unsigned long cl_state; | ||
559 | |||
560 | u32 cl_lockowner_id; | ||
561 | |||
562 | /* | ||
563 | * The following rwsem ensures exclusive access to the server | ||
564 | * while we recover the state following a lease expiration. | ||
565 | */ | ||
566 | struct rw_semaphore cl_sem; | ||
567 | |||
568 | struct list_head cl_delegations; | ||
569 | struct list_head cl_state_owners; | ||
570 | struct list_head cl_unused; | ||
571 | int cl_nunused; | ||
572 | spinlock_t cl_lock; | ||
573 | atomic_t cl_count; | ||
574 | |||
575 | struct rpc_clnt * cl_rpcclient; | ||
576 | struct rpc_cred * cl_cred; | ||
577 | |||
578 | struct list_head cl_superblocks; /* List of nfs_server structs */ | ||
579 | |||
580 | unsigned long cl_lease_time; | ||
581 | unsigned long cl_last_renewal; | ||
582 | struct work_struct cl_renewd; | ||
583 | struct work_struct cl_recoverd; | ||
584 | |||
585 | wait_queue_head_t cl_waitq; | ||
586 | struct rpc_wait_queue cl_rpcwaitq; | ||
587 | |||
588 | /* used for the setclientid verifier */ | ||
589 | struct timespec cl_boot_time; | ||
590 | |||
591 | /* idmapper */ | ||
592 | struct idmap * cl_idmap; | ||
593 | |||
594 | /* Our own IP address, as a null-terminated string. | ||
595 | * This is used to generate the clientid, and the callback address. | ||
596 | */ | ||
597 | char cl_ipaddr[16]; | ||
598 | unsigned char cl_id_uniquifier; | ||
599 | }; | ||
600 | |||
601 | /* | ||
602 | * NFS4 state_owners and lock_owners are simply labels for ordered | ||
603 | * sequences of RPC calls. Their sole purpose is to provide once-only | ||
604 | * semantics by allowing the server to identify replayed requests. | ||
605 | * | ||
606 | * The ->so_sema is held during all state_owner seqid-mutating operations: | ||
607 | * OPEN, OPEN_DOWNGRADE, and CLOSE. Its purpose is to properly serialize | ||
608 | * so_seqid. | ||
609 | */ | ||
610 | struct nfs4_state_owner { | ||
611 | struct list_head so_list; /* per-clientid list of state_owners */ | ||
612 | struct nfs4_client *so_client; | ||
613 | u32 so_id; /* 32-bit identifier, unique */ | ||
614 | struct semaphore so_sema; | ||
615 | u32 so_seqid; /* protected by so_sema */ | ||
616 | atomic_t so_count; | ||
617 | |||
618 | struct rpc_cred *so_cred; /* Associated cred */ | ||
619 | struct list_head so_states; | ||
620 | struct list_head so_delegations; | ||
621 | }; | ||
622 | |||
623 | /* | ||
624 | * struct nfs4_state maintains the client-side state for a given | ||
625 | * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). | ||
626 | * | ||
627 | * OPEN: | ||
628 | * In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server, | ||
629 | * we need to know how many files are open for reading or writing on a | ||
630 | * given inode. This information too is stored here. | ||
631 | * | ||
632 | * LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN) | ||
633 | */ | ||
634 | |||
635 | struct nfs4_lock_state { | ||
636 | struct list_head ls_locks; /* Other lock stateids */ | ||
637 | fl_owner_t ls_owner; /* POSIX lock owner */ | ||
638 | #define NFS_LOCK_INITIALIZED 1 | ||
639 | int ls_flags; | ||
640 | u32 ls_seqid; | ||
641 | u32 ls_id; | ||
642 | nfs4_stateid ls_stateid; | ||
643 | atomic_t ls_count; | ||
644 | }; | ||
645 | |||
646 | /* bits for nfs4_state->flags */ | ||
647 | enum { | ||
648 | LK_STATE_IN_USE, | ||
649 | NFS_DELEGATED_STATE, | ||
650 | }; | ||
651 | |||
652 | struct nfs4_state { | ||
653 | struct list_head open_states; /* List of states for the same state_owner */ | ||
654 | struct list_head inode_states; /* List of states for the same inode */ | ||
655 | struct list_head lock_states; /* List of subservient lock stateids */ | ||
656 | |||
657 | struct nfs4_state_owner *owner; /* Pointer to the open owner */ | ||
658 | struct inode *inode; /* Pointer to the inode */ | ||
659 | |||
660 | unsigned long flags; /* Do we hold any locks? */ | ||
661 | struct semaphore lock_sema; /* Serializes file locking operations */ | ||
662 | rwlock_t state_lock; /* Protects the lock_states list */ | ||
663 | |||
664 | nfs4_stateid stateid; | ||
665 | |||
666 | unsigned int nreaders; | ||
667 | unsigned int nwriters; | ||
668 | int state; /* State on the server (R,W, or RW) */ | ||
669 | atomic_t count; | ||
670 | }; | ||
671 | |||
672 | |||
673 | struct nfs4_exception { | ||
674 | long timeout; | ||
675 | int retry; | ||
676 | }; | ||
677 | |||
678 | struct nfs4_state_recovery_ops { | ||
679 | int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); | ||
680 | int (*recover_lock)(struct nfs4_state *, struct file_lock *); | ||
681 | }; | ||
682 | |||
683 | extern struct dentry_operations nfs4_dentry_operations; | ||
684 | extern struct inode_operations nfs4_dir_inode_operations; | ||
685 | |||
686 | /* nfs4proc.c */ | ||
687 | extern int nfs4_map_errors(int err); | ||
688 | extern int nfs4_proc_setclientid(struct nfs4_client *, u32, unsigned short); | ||
689 | extern int nfs4_proc_setclientid_confirm(struct nfs4_client *); | ||
690 | extern int nfs4_proc_async_renew(struct nfs4_client *); | ||
691 | extern int nfs4_proc_renew(struct nfs4_client *); | ||
692 | extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); | ||
693 | extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); | ||
694 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int); | ||
695 | |||
696 | extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops; | ||
697 | extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops; | ||
698 | |||
699 | /* nfs4renewd.c */ | ||
700 | extern void nfs4_schedule_state_renewal(struct nfs4_client *); | ||
701 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); | ||
702 | extern void nfs4_kill_renewd(struct nfs4_client *); | ||
703 | |||
704 | /* nfs4state.c */ | ||
705 | extern void init_nfsv4_state(struct nfs_server *); | ||
706 | extern void destroy_nfsv4_state(struct nfs_server *); | ||
707 | extern struct nfs4_client *nfs4_get_client(struct in_addr *); | ||
708 | extern void nfs4_put_client(struct nfs4_client *clp); | ||
709 | extern int nfs4_init_client(struct nfs4_client *clp); | ||
710 | extern struct nfs4_client *nfs4_find_client(struct in_addr *); | ||
711 | extern u32 nfs4_alloc_lockowner_id(struct nfs4_client *); | ||
712 | |||
713 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); | ||
714 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); | ||
715 | extern void nfs4_drop_state_owner(struct nfs4_state_owner *); | ||
716 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); | ||
717 | extern void nfs4_put_open_state(struct nfs4_state *); | ||
718 | extern void nfs4_close_state(struct nfs4_state *, mode_t); | ||
719 | extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode); | ||
720 | extern void nfs4_increment_seqid(int status, struct nfs4_state_owner *sp); | ||
721 | extern void nfs4_schedule_state_recovery(struct nfs4_client *); | ||
722 | extern struct nfs4_lock_state *nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t); | ||
723 | extern struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t); | ||
724 | extern void nfs4_put_lock_state(struct nfs4_lock_state *state); | ||
725 | extern void nfs4_increment_lock_seqid(int status, struct nfs4_lock_state *ls); | ||
726 | extern void nfs4_notify_setlk(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); | ||
727 | extern void nfs4_notify_unlck(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); | ||
728 | extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); | ||
729 | |||
730 | |||
731 | |||
732 | struct nfs4_mount_data; | ||
733 | #else | ||
734 | #define init_nfsv4_state(server) do { } while (0) | ||
735 | #define destroy_nfsv4_state(server) do { } while (0) | ||
736 | #define nfs4_put_state_owner(inode, owner) do { } while (0) | ||
737 | #define nfs4_put_open_state(state) do { } while (0) | ||
738 | #define nfs4_close_state(a, b) do { } while (0) | ||
739 | #define nfs4_renewd_prepare_shutdown(server) do { } while (0) | ||
740 | #endif | ||
741 | |||
742 | #endif /* __KERNEL__ */ | 501 | #endif /* __KERNEL__ */ |
743 | 502 | ||
744 | /* | 503 | /* |