aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:21:53 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 13:46:19 -0400
commit557134a39c8d2ab79d8b8d53438e03e29feb5ec4 (patch)
tree3f6999d9601618102413fd535ff95f9be0babd85 /include
parent9ff71c3a9827b99699510076dffa0bbe7c36bfd4 (diff)
nfs41: sessions client infrastructure
NFSv4.1 Sessions basic data types, initialization, and destruction. The session is always associated with a struct nfs_client that holds the exchange_id results. Signed-off-by: Rahul Iyer <iyer@netapp.com> Signed-off-by: Andy Adamson<andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [remove extraneous rpc_clnt pointer, use the struct nfs_client cl_rpcclient. remove the rpc_clnt parameter from nfs4 nfs4_init_session] Signed-off-by: Andy Adamson<andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Use the presence of a session to determine behaviour instead of the minorversion number.] Signed-off-by: Andy Adamson <andros@netapp.com> [constified nfs4_has_session's struct nfs_client parameter] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Rename nfs4_put_session() to nfs4_destroy_session() and call it from nfs4_free_client() not nfs4_free_server(). Also get rid of nfs4_get_session() and the ref_count in nfs4_session struct as keeping track of nfs_client should be sufficient] Signed-off-by: Alexandros Batsakis <Alexandros.Batsakis@netapp.com> [nfs41: pass rsize and wsize into nfs4_init_session] Signed-off-by: Andy Adamson <andros@netapp.com> [separated out removal of rpc_clnt parameter from nfs4_init_session ot a patch of its own] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Pass the nfs_client pointer into nfs4_alloc_session] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: don't assign to session->clp->cl_session in nfs4_destroy_session] [nfs41: fixup nfs4_clear_client_minor_version] [introduce nfs4_clear_client_minor_version() in this patch] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Refactor nfs4_init_session] Moved session allocation into nfs4_init_client_minor_version, called from nfs4_init_client. Leave rwise and wsize initialization in nfs4_init_session, called from nfs4_init_server. Reverted moving of nfs_fsid definition to nfs_fs_sb.h Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: Move NFS4_MAX_SLOT_TABLE define from under CONFIG_NFS_V4_1] [Fix comile error when CONFIG_NFS_V4_1 is not set.] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [moved nfs4_init_slot_table definition to "create_session operation"] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: alloc session with GFP_KERNEL] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfs_fs_sb.h49
-rw-r--r--include/linux/nfs_xdr.h15
2 files changed, 64 insertions, 0 deletions
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index e9a51fe46aa3..b47c0fc55d42 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -4,9 +4,12 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/wait.h> 6#include <linux/wait.h>
7#include <linux/nfs_xdr.h>
8#include <linux/sunrpc/xprt.h>
7 9
8#include <asm/atomic.h> 10#include <asm/atomic.h>
9 11
12struct nfs4_session;
10struct nfs_iostats; 13struct nfs_iostats;
11struct nlm_host; 14struct nlm_host;
12 15
@@ -66,6 +69,10 @@ struct nfs_client {
66 unsigned char cl_id_uniquifier; 69 unsigned char cl_id_uniquifier;
67#endif /* CONFIG_NFS_V4 */ 70#endif /* CONFIG_NFS_V4 */
68 71
72#ifdef CONFIG_NFS_V4_1
73 struct nfs4_session *cl_session; /* sharred session */
74#endif /* CONFIG_NFS_V4_1 */
75
69#ifdef CONFIG_NFS_FSCACHE 76#ifdef CONFIG_NFS_FSCACHE
70 struct fscache_cookie *fscache; /* client index cache cookie */ 77 struct fscache_cookie *fscache; /* client index cache cookie */
71#endif 78#endif
@@ -146,4 +153,46 @@ struct nfs_server {
146#define NFS_CAP_ACLS (1U << 3) 153#define NFS_CAP_ACLS (1U << 3)
147#define NFS_CAP_ATOMIC_OPEN (1U << 4) 154#define NFS_CAP_ATOMIC_OPEN (1U << 4)
148 155
156
157/* maximum number of slots to use */
158#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE
159
160#if defined(CONFIG_NFS_V4_1)
161
162/* Sessions */
163#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long)))
164struct nfs4_slot_table {
165 struct nfs4_slot *slots; /* seqid per slot */
166 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
167 spinlock_t slot_tbl_lock;
168 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
169 int max_slots; /* # slots in table */
170 int highest_used_slotid; /* sent to server on each SEQ.
171 * op for dynamic resizing */
172};
173
174static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
175{
176 return sp - tbl->slots;
177}
178
179/*
180 * Session related parameters
181 */
182struct nfs4_session {
183 struct nfs4_sessionid sess_id;
184 u32 flags;
185 unsigned long session_state;
186 u32 hash_alg;
187 u32 ssv_len;
188
189 /* The fore and back channel */
190 struct nfs4_channel_attrs fc_attrs;
191 struct nfs4_slot_table fc_slot_table;
192 struct nfs4_channel_attrs bc_attrs;
193 /* back channel has one slot */
194 struct nfs_client *clp;
195};
196
197#endif /* CONFIG_NFS_V4_1 */
149#endif 198#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index f2c5700c7b6e..8f8c026c558e 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -146,6 +146,21 @@ struct nfs4_change_info {
146 146
147struct nfs_seqid; 147struct nfs_seqid;
148 148
149/* nfs41 sessions channel attributes */
150struct nfs4_channel_attrs {
151 u32 headerpadsz;
152 u32 max_rqst_sz;
153 u32 max_resp_sz;
154 u32 max_resp_sz_cached;
155 u32 max_ops;
156 u32 max_reqs;
157};
158
159/* nfs41 sessions slot seqid */
160struct nfs4_slot {
161 u32 seq_nr;
162};
163
149struct nfs4_sequence_args { 164struct nfs4_sequence_args {
150 /* stub */ 165 /* stub */
151}; 166};