diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-26 14:20:49 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-12-05 18:30:46 -0500 |
commit | 76e697ba7e8d187f50e385d21a2b2f1709a62c14 (patch) | |
tree | 2270645beb0b0c44079d98107bab61943e3f4d31 /fs | |
parent | c34309a45ea491e5f0c0d0af49ccfa018ff35fc1 (diff) |
NFSv4.1: Move slot table and session struct definitions to nfs4session.h
Clean up. Gather NFSv4.1 slot definitions in fs/nfs/nfs4session.h.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 1 | ||||
-rw-r--r-- | fs/nfs/callback_xdr.c | 1 | ||||
-rw-r--r-- | fs/nfs/internal.h | 21 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 12 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4session.h | 101 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 1 | ||||
-rw-r--r-- | fs/nfs/super.c | 1 |
9 files changed, 107 insertions, 33 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index f1027b06a1a9..4fa788c93f46 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/pagevec.h> | 40 | #include <linux/pagevec.h> |
41 | 41 | ||
42 | #include "../pnfs.h" | 42 | #include "../pnfs.h" |
43 | #include "../nfs4session.h" | ||
43 | #include "../internal.h" | 44 | #include "../internal.h" |
44 | #include "blocklayout.h" | 45 | #include "blocklayout.h" |
45 | 46 | ||
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index ea6a7b190e6b..59461c957d9d 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include "nfs4_fs.h" | 16 | #include "nfs4_fs.h" |
17 | #include "callback.h" | 17 | #include "callback.h" |
18 | #include "internal.h" | 18 | #include "internal.h" |
19 | #include "nfs4session.h" | ||
19 | 20 | ||
20 | #define CB_OP_TAGLEN_MAXSZ (512) | 21 | #define CB_OP_TAGLEN_MAXSZ (512) |
21 | #define CB_OP_HDR_RES_MAXSZ (2 + CB_OP_TAGLEN_MAXSZ) | 22 | #define CB_OP_HDR_RES_MAXSZ (2 + CB_OP_TAGLEN_MAXSZ) |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 8965a998b306..9bdbfc3884a9 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -18,27 +18,6 @@ struct nfs_string; | |||
18 | */ | 18 | */ |
19 | #define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) | 19 | #define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) |
20 | 20 | ||
21 | /* | ||
22 | * Determine if sessions are in use. | ||
23 | */ | ||
24 | static inline int nfs4_has_session(const struct nfs_client *clp) | ||
25 | { | ||
26 | #ifdef CONFIG_NFS_V4_1 | ||
27 | if (clp->cl_session) | ||
28 | return 1; | ||
29 | #endif /* CONFIG_NFS_V4_1 */ | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | static inline int nfs4_has_persistent_session(const struct nfs_client *clp) | ||
34 | { | ||
35 | #ifdef CONFIG_NFS_V4_1 | ||
36 | if (nfs4_has_session(clp)) | ||
37 | return (clp->cl_session->flags & SESSION4_PERSIST); | ||
38 | #endif /* CONFIG_NFS_V4_1 */ | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct nfs_fattr *fattr) | 21 | static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct nfs_fattr *fattr) |
43 | { | 22 | { |
44 | if (!nfs_fsid_equal(&NFS_SB(parent)->fsid, &fattr->fsid)) | 23 | if (!nfs_fsid_equal(&NFS_SB(parent)->fsid, &fattr->fsid)) |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index cd3e3096b60a..322bd0168ebf 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -29,11 +29,6 @@ enum nfs4_client_state { | |||
29 | NFS4CLNT_BIND_CONN_TO_SESSION, | 29 | NFS4CLNT_BIND_CONN_TO_SESSION, |
30 | }; | 30 | }; |
31 | 31 | ||
32 | enum nfs4_session_state { | ||
33 | NFS4_SESSION_INITING, | ||
34 | NFS4_SESSION_DRAINING, | ||
35 | }; | ||
36 | |||
37 | #define NFS4_RENEW_TIMEOUT 0x01 | 32 | #define NFS4_RENEW_TIMEOUT 0x01 |
38 | #define NFS4_RENEW_DELEGATION_CB 0x02 | 33 | #define NFS4_RENEW_DELEGATION_CB 0x02 |
39 | 34 | ||
@@ -327,13 +322,6 @@ int nfs41_discover_server_trunking(struct nfs_client *clp, | |||
327 | extern void nfs4_schedule_session_recovery(struct nfs4_session *, int); | 322 | extern void nfs4_schedule_session_recovery(struct nfs4_session *, int); |
328 | extern void nfs41_server_notify_target_slotid_update(struct nfs_client *clp); | 323 | extern void nfs41_server_notify_target_slotid_update(struct nfs_client *clp); |
329 | 324 | ||
330 | extern void nfs4_session_drain_complete(struct nfs4_session *session, | ||
331 | struct nfs4_slot_table *tbl); | ||
332 | |||
333 | static inline bool nfs4_session_draining(struct nfs4_session *session) | ||
334 | { | ||
335 | return !!test_bit(NFS4_SESSION_DRAINING, &session->session_state); | ||
336 | } | ||
337 | #else | 325 | #else |
338 | static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err) | 326 | static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err) |
339 | { | 327 | { |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index bfb28fa38e74..591a1a7f8f94 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/sunrpc/metrics.h> | 36 | #include <linux/sunrpc/metrics.h> |
37 | 37 | ||
38 | #include "nfs4session.h" | ||
38 | #include "internal.h" | 39 | #include "internal.h" |
39 | #include "delegation.h" | 40 | #include "delegation.h" |
40 | #include "nfs4filelayout.h" | 41 | #include "nfs4filelayout.h" |
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h index cb47b1eb0886..e96323ff1d95 100644 --- a/fs/nfs/nfs4session.h +++ b/fs/nfs/nfs4session.h | |||
@@ -7,6 +7,68 @@ | |||
7 | #ifndef __LINUX_FS_NFS_NFS4SESSION_H | 7 | #ifndef __LINUX_FS_NFS_NFS4SESSION_H |
8 | #define __LINUX_FS_NFS_NFS4SESSION_H | 8 | #define __LINUX_FS_NFS_NFS4SESSION_H |
9 | 9 | ||
10 | /* maximum number of slots to use */ | ||
11 | #define NFS4_DEF_SLOT_TABLE_SIZE (16U) | ||
12 | #define NFS4_MAX_SLOT_TABLE (256U) | ||
13 | #define NFS4_NO_SLOT ((u32)-1) | ||
14 | |||
15 | #if IS_ENABLED(CONFIG_NFS_V4) | ||
16 | |||
17 | /* Sessions slot seqid */ | ||
18 | struct nfs4_slot { | ||
19 | struct nfs4_slot_table *table; | ||
20 | struct nfs4_slot *next; | ||
21 | unsigned long generation; | ||
22 | unsigned long renewal_time; | ||
23 | u32 slot_nr; | ||
24 | u32 seq_nr; | ||
25 | }; | ||
26 | |||
27 | /* Sessions */ | ||
28 | #define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long)) | ||
29 | struct nfs4_slot_table { | ||
30 | struct nfs4_session *session; /* Parent session */ | ||
31 | struct nfs4_slot *slots; /* seqid per slot */ | ||
32 | unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ | ||
33 | spinlock_t slot_tbl_lock; | ||
34 | struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ | ||
35 | u32 max_slots; /* # slots in table */ | ||
36 | u32 max_slotid; /* Max allowed slotid value */ | ||
37 | u32 highest_used_slotid; /* sent to server on each SEQ. | ||
38 | * op for dynamic resizing */ | ||
39 | u32 target_highest_slotid; /* Server max_slot target */ | ||
40 | u32 server_highest_slotid; /* Server highest slotid */ | ||
41 | unsigned long generation; /* Generation counter for | ||
42 | target_highest_slotid */ | ||
43 | struct completion complete; | ||
44 | }; | ||
45 | |||
46 | /* | ||
47 | * Session related parameters | ||
48 | */ | ||
49 | struct nfs4_session { | ||
50 | struct nfs4_sessionid sess_id; | ||
51 | u32 flags; | ||
52 | unsigned long session_state; | ||
53 | u32 hash_alg; | ||
54 | u32 ssv_len; | ||
55 | |||
56 | /* The fore and back channel */ | ||
57 | struct nfs4_channel_attrs fc_attrs; | ||
58 | struct nfs4_slot_table fc_slot_table; | ||
59 | struct nfs4_channel_attrs bc_attrs; | ||
60 | struct nfs4_slot_table bc_slot_table; | ||
61 | struct nfs_client *clp; | ||
62 | /* Create session arguments */ | ||
63 | unsigned int fc_target_max_rqst_sz; | ||
64 | unsigned int fc_target_max_resp_sz; | ||
65 | }; | ||
66 | |||
67 | enum nfs4_session_state { | ||
68 | NFS4_SESSION_INITING, | ||
69 | NFS4_SESSION_DRAINING, | ||
70 | }; | ||
71 | |||
10 | #if defined(CONFIG_NFS_V4_1) | 72 | #if defined(CONFIG_NFS_V4_1) |
11 | extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl); | 73 | extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl); |
12 | extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); | 74 | extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); |
@@ -24,6 +86,31 @@ extern void nfs4_destroy_session(struct nfs4_session *session); | |||
24 | extern int nfs4_init_session(struct nfs_server *server); | 86 | extern int nfs4_init_session(struct nfs_server *server); |
25 | extern int nfs4_init_ds_session(struct nfs_client *, unsigned long); | 87 | extern int nfs4_init_ds_session(struct nfs_client *, unsigned long); |
26 | 88 | ||
89 | extern void nfs4_session_drain_complete(struct nfs4_session *session, | ||
90 | struct nfs4_slot_table *tbl); | ||
91 | |||
92 | static inline bool nfs4_session_draining(struct nfs4_session *session) | ||
93 | { | ||
94 | return !!test_bit(NFS4_SESSION_DRAINING, &session->session_state); | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Determine if sessions are in use. | ||
99 | */ | ||
100 | static inline int nfs4_has_session(const struct nfs_client *clp) | ||
101 | { | ||
102 | if (clp->cl_session) | ||
103 | return 1; | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static inline int nfs4_has_persistent_session(const struct nfs_client *clp) | ||
108 | { | ||
109 | if (nfs4_has_session(clp)) | ||
110 | return (clp->cl_session->flags & SESSION4_PERSIST); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
27 | #else /* defined(CONFIG_NFS_V4_1) */ | 114 | #else /* defined(CONFIG_NFS_V4_1) */ |
28 | 115 | ||
29 | static inline int nfs4_init_session(struct nfs_server *server) | 116 | static inline int nfs4_init_session(struct nfs_server *server) |
@@ -31,5 +118,19 @@ static inline int nfs4_init_session(struct nfs_server *server) | |||
31 | return 0; | 118 | return 0; |
32 | } | 119 | } |
33 | 120 | ||
121 | /* | ||
122 | * Determine if sessions are in use. | ||
123 | */ | ||
124 | static inline int nfs4_has_session(const struct nfs_client *clp) | ||
125 | { | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static inline int nfs4_has_persistent_session(const struct nfs_client *clp) | ||
130 | { | ||
131 | return 0; | ||
132 | } | ||
133 | |||
34 | #endif /* defined(CONFIG_NFS_V4_1) */ | 134 | #endif /* defined(CONFIG_NFS_V4_1) */ |
135 | #endif /* IS_ENABLED(CONFIG_NFS_V4) */ | ||
35 | #endif /* __LINUX_FS_NFS_NFS4SESSION_H */ | 136 | #endif /* __LINUX_FS_NFS_NFS4SESSION_H */ |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 1077b9698381..1402283d152d 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include "callback.h" | 57 | #include "callback.h" |
58 | #include "delegation.h" | 58 | #include "delegation.h" |
59 | #include "internal.h" | 59 | #include "internal.h" |
60 | #include "nfs4session.h" | ||
60 | #include "pnfs.h" | 61 | #include "pnfs.h" |
61 | #include "netns.h" | 62 | #include "netns.h" |
62 | 63 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index a67040f51597..e786dc7582b1 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | #include "nfs4_fs.h" | 57 | #include "nfs4_fs.h" |
58 | #include "internal.h" | 58 | #include "internal.h" |
59 | #include "nfs4session.h" | ||
59 | #include "pnfs.h" | 60 | #include "pnfs.h" |
60 | #include "netns.h" | 61 | #include "netns.h" |
61 | 62 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 652d3f7176a9..e12cea4b36a5 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include "iostat.h" | 64 | #include "iostat.h" |
65 | #include "internal.h" | 65 | #include "internal.h" |
66 | #include "fscache.h" | 66 | #include "fscache.h" |
67 | #include "nfs4session.h" | ||
67 | #include "pnfs.h" | 68 | #include "pnfs.h" |
68 | #include "nfs.h" | 69 | #include "nfs.h" |
69 | 70 | ||