aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-22 20:06:08 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:31 -0400
commitadfa6f980bd46974e6b32b22dd0c45e3f52063f4 (patch)
tree7dbc86985faa0fce0e73103979262c1593ea3a3b /fs/nfs/nfs4state.c
parent5ae1fbce142b67bf59e15fb1af96e88a96abde7b (diff)
NFS: Rename struct nfs4_client to struct nfs_client
Rename struct nfs4_client to struct nfs_client so that it can become the basis for a general client record for NFS2 and NFS3 in addition to NFS4. Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 090a36b07a22..c0b6439f1f71 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -83,10 +83,10 @@ destroy_nfsv4_state(struct nfs_server *server)
83 * Since these are allocated/deallocated very rarely, we don't 83 * Since these are allocated/deallocated very rarely, we don't
84 * bother putting them in a slab cache... 84 * bother putting them in a slab cache...
85 */ 85 */
86static struct nfs4_client * 86static struct nfs_client *
87nfs4_alloc_client(struct in_addr *addr) 87nfs4_alloc_client(struct in_addr *addr)
88{ 88{
89 struct nfs4_client *clp; 89 struct nfs_client *clp;
90 90
91 if (nfs_callback_up() < 0) 91 if (nfs_callback_up() < 0)
92 return NULL; 92 return NULL;
@@ -111,7 +111,7 @@ nfs4_alloc_client(struct in_addr *addr)
111} 111}
112 112
113static void 113static void
114nfs4_free_client(struct nfs4_client *clp) 114nfs4_free_client(struct nfs_client *clp)
115{ 115{
116 struct nfs4_state_owner *sp; 116 struct nfs4_state_owner *sp;
117 117
@@ -130,9 +130,9 @@ nfs4_free_client(struct nfs4_client *clp)
130 nfs_callback_down(); 130 nfs_callback_down();
131} 131}
132 132
133static struct nfs4_client *__nfs4_find_client(struct in_addr *addr) 133static struct nfs_client *__nfs4_find_client(struct in_addr *addr)
134{ 134{
135 struct nfs4_client *clp; 135 struct nfs_client *clp;
136 list_for_each_entry(clp, &nfs4_clientid_list, cl_servers) { 136 list_for_each_entry(clp, &nfs4_clientid_list, cl_servers) {
137 if (memcmp(&clp->cl_addr, addr, sizeof(clp->cl_addr)) == 0) { 137 if (memcmp(&clp->cl_addr, addr, sizeof(clp->cl_addr)) == 0) {
138 atomic_inc(&clp->cl_count); 138 atomic_inc(&clp->cl_count);
@@ -142,19 +142,19 @@ static struct nfs4_client *__nfs4_find_client(struct in_addr *addr)
142 return NULL; 142 return NULL;
143} 143}
144 144
145struct nfs4_client *nfs4_find_client(struct in_addr *addr) 145struct nfs_client *nfs4_find_client(struct in_addr *addr)
146{ 146{
147 struct nfs4_client *clp; 147 struct nfs_client *clp;
148 spin_lock(&state_spinlock); 148 spin_lock(&state_spinlock);
149 clp = __nfs4_find_client(addr); 149 clp = __nfs4_find_client(addr);
150 spin_unlock(&state_spinlock); 150 spin_unlock(&state_spinlock);
151 return clp; 151 return clp;
152} 152}
153 153
154struct nfs4_client * 154struct nfs_client *
155nfs4_get_client(struct in_addr *addr) 155nfs4_get_client(struct in_addr *addr)
156{ 156{
157 struct nfs4_client *clp, *new = NULL; 157 struct nfs_client *clp, *new = NULL;
158 158
159 spin_lock(&state_spinlock); 159 spin_lock(&state_spinlock);
160 for (;;) { 160 for (;;) {
@@ -180,7 +180,7 @@ nfs4_get_client(struct in_addr *addr)
180} 180}
181 181
182void 182void
183nfs4_put_client(struct nfs4_client *clp) 183nfs4_put_client(struct nfs_client *clp)
184{ 184{
185 if (!atomic_dec_and_lock(&clp->cl_count, &state_spinlock)) 185 if (!atomic_dec_and_lock(&clp->cl_count, &state_spinlock))
186 return; 186 return;
@@ -192,7 +192,7 @@ nfs4_put_client(struct nfs4_client *clp)
192 nfs4_free_client(clp); 192 nfs4_free_client(clp);
193} 193}
194 194
195static int nfs4_init_client(struct nfs4_client *clp, struct rpc_cred *cred) 195static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred)
196{ 196{
197 int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, 197 int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK,
198 nfs_callback_tcpport, cred); 198 nfs_callback_tcpport, cred);
@@ -204,13 +204,13 @@ static int nfs4_init_client(struct nfs4_client *clp, struct rpc_cred *cred)
204} 204}
205 205
206u32 206u32
207nfs4_alloc_lockowner_id(struct nfs4_client *clp) 207nfs4_alloc_lockowner_id(struct nfs_client *clp)
208{ 208{
209 return clp->cl_lockowner_id ++; 209 return clp->cl_lockowner_id ++;
210} 210}
211 211
212static struct nfs4_state_owner * 212static struct nfs4_state_owner *
213nfs4_client_grab_unused(struct nfs4_client *clp, struct rpc_cred *cred) 213nfs4_client_grab_unused(struct nfs_client *clp, struct rpc_cred *cred)
214{ 214{
215 struct nfs4_state_owner *sp = NULL; 215 struct nfs4_state_owner *sp = NULL;
216 216
@@ -224,7 +224,7 @@ nfs4_client_grab_unused(struct nfs4_client *clp, struct rpc_cred *cred)
224 return sp; 224 return sp;
225} 225}
226 226
227struct rpc_cred *nfs4_get_renew_cred(struct nfs4_client *clp) 227struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
228{ 228{
229 struct nfs4_state_owner *sp; 229 struct nfs4_state_owner *sp;
230 struct rpc_cred *cred = NULL; 230 struct rpc_cred *cred = NULL;
@@ -238,7 +238,7 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs4_client *clp)
238 return cred; 238 return cred;
239} 239}
240 240
241struct rpc_cred *nfs4_get_setclientid_cred(struct nfs4_client *clp) 241struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
242{ 242{
243 struct nfs4_state_owner *sp; 243 struct nfs4_state_owner *sp;
244 244
@@ -251,7 +251,7 @@ struct rpc_cred *nfs4_get_setclientid_cred(struct nfs4_client *clp)
251} 251}
252 252
253static struct nfs4_state_owner * 253static struct nfs4_state_owner *
254nfs4_find_state_owner(struct nfs4_client *clp, struct rpc_cred *cred) 254nfs4_find_state_owner(struct nfs_client *clp, struct rpc_cred *cred)
255{ 255{
256 struct nfs4_state_owner *sp, *res = NULL; 256 struct nfs4_state_owner *sp, *res = NULL;
257 257
@@ -294,7 +294,7 @@ nfs4_alloc_state_owner(void)
294void 294void
295nfs4_drop_state_owner(struct nfs4_state_owner *sp) 295nfs4_drop_state_owner(struct nfs4_state_owner *sp)
296{ 296{
297 struct nfs4_client *clp = sp->so_client; 297 struct nfs_client *clp = sp->so_client;
298 spin_lock(&clp->cl_lock); 298 spin_lock(&clp->cl_lock);
299 list_del_init(&sp->so_list); 299 list_del_init(&sp->so_list);
300 spin_unlock(&clp->cl_lock); 300 spin_unlock(&clp->cl_lock);
@@ -306,7 +306,7 @@ nfs4_drop_state_owner(struct nfs4_state_owner *sp)
306 */ 306 */
307struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred) 307struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred)
308{ 308{
309 struct nfs4_client *clp = server->nfs4_state; 309 struct nfs_client *clp = server->nfs4_state;
310 struct nfs4_state_owner *sp, *new; 310 struct nfs4_state_owner *sp, *new;
311 311
312 get_rpccred(cred); 312 get_rpccred(cred);
@@ -337,7 +337,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
337 */ 337 */
338void nfs4_put_state_owner(struct nfs4_state_owner *sp) 338void nfs4_put_state_owner(struct nfs4_state_owner *sp)
339{ 339{
340 struct nfs4_client *clp = sp->so_client; 340 struct nfs_client *clp = sp->so_client;
341 struct rpc_cred *cred = sp->so_cred; 341 struct rpc_cred *cred = sp->so_cred;
342 342
343 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) 343 if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
@@ -540,7 +540,7 @@ __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
540static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, fl_owner_t fl_owner) 540static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
541{ 541{
542 struct nfs4_lock_state *lsp; 542 struct nfs4_lock_state *lsp;
543 struct nfs4_client *clp = state->owner->so_client; 543 struct nfs_client *clp = state->owner->so_client;
544 544
545 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL); 545 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
546 if (lsp == NULL) 546 if (lsp == NULL)
@@ -752,7 +752,7 @@ out:
752 752
753static int reclaimer(void *); 753static int reclaimer(void *);
754 754
755static inline void nfs4_clear_recover_bit(struct nfs4_client *clp) 755static inline void nfs4_clear_recover_bit(struct nfs_client *clp)
756{ 756{
757 smp_mb__before_clear_bit(); 757 smp_mb__before_clear_bit();
758 clear_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state); 758 clear_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state);
@@ -764,7 +764,7 @@ static inline void nfs4_clear_recover_bit(struct nfs4_client *clp)
764/* 764/*
765 * State recovery routine 765 * State recovery routine
766 */ 766 */
767static void nfs4_recover_state(struct nfs4_client *clp) 767static void nfs4_recover_state(struct nfs_client *clp)
768{ 768{
769 struct task_struct *task; 769 struct task_struct *task;
770 770
@@ -782,7 +782,7 @@ static void nfs4_recover_state(struct nfs4_client *clp)
782/* 782/*
783 * Schedule a state recovery attempt 783 * Schedule a state recovery attempt
784 */ 784 */
785void nfs4_schedule_state_recovery(struct nfs4_client *clp) 785void nfs4_schedule_state_recovery(struct nfs_client *clp)
786{ 786{
787 if (!clp) 787 if (!clp)
788 return; 788 return;
@@ -879,7 +879,7 @@ out_err:
879 return status; 879 return status;
880} 880}
881 881
882static void nfs4_state_mark_reclaim(struct nfs4_client *clp) 882static void nfs4_state_mark_reclaim(struct nfs_client *clp)
883{ 883{
884 struct nfs4_state_owner *sp; 884 struct nfs4_state_owner *sp;
885 struct nfs4_state *state; 885 struct nfs4_state *state;
@@ -903,7 +903,7 @@ static void nfs4_state_mark_reclaim(struct nfs4_client *clp)
903 903
904static int reclaimer(void *ptr) 904static int reclaimer(void *ptr)
905{ 905{
906 struct nfs4_client *clp = ptr; 906 struct nfs_client *clp = ptr;
907 struct nfs4_state_owner *sp; 907 struct nfs4_state_owner *sp;
908 struct nfs4_state_recovery_ops *ops; 908 struct nfs4_state_recovery_ops *ops;
909 struct rpc_cred *cred; 909 struct rpc_cred *cred;