aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2007-04-26 18:49:28 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-26 18:49:28 -0400
commitec26815ad847dbf74a1e27aa5515fb7d5dc6ee6f (patch)
tree32510ab35b3524f6be9231ab8065b80be5d9b68d
parent17926a79320afa9b95df6b977b40cca6d8713cea (diff)
[AFS]: Clean up the AFS sources
Clean up the AFS sources. Also remove references to AFS keys. RxRPC keys are used instead. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--fs/afs/Makefile2
-rw-r--r--fs/afs/cache.h12
-rw-r--r--fs/afs/callback.c9
-rw-r--r--fs/afs/cell.c51
-rw-r--r--fs/afs/cell.h30
-rw-r--r--fs/afs/cmservice.c46
-rw-r--r--fs/afs/cmservice.h17
-rw-r--r--fs/afs/dir.c50
-rw-r--r--fs/afs/errors.h14
-rw-r--r--fs/afs/file.c20
-rw-r--r--fs/afs/fsclient.c73
-rw-r--r--fs/afs/fsclient.h48
-rw-r--r--fs/afs/inode.c29
-rw-r--r--fs/afs/internal.h36
-rw-r--r--fs/afs/kafsasyncd.c22
-rw-r--r--fs/afs/kafsasyncd.h22
-rw-r--r--fs/afs/kafstimod.c31
-rw-r--r--fs/afs/kafstimod.h20
-rw-r--r--fs/afs/main.c94
-rw-r--r--fs/afs/misc.c6
-rw-r--r--fs/afs/mntpt.c27
-rw-r--r--fs/afs/mount.h8
-rw-r--r--fs/afs/proc.c161
-rw-r--r--fs/afs/server.c47
-rw-r--r--fs/afs/server.h41
-rw-r--r--fs/afs/super.c62
-rw-r--r--fs/afs/super.h16
-rw-r--r--fs/afs/transport.h8
-rw-r--r--fs/afs/types.h34
-rw-r--r--fs/afs/vlclient.c58
-rw-r--r--fs/afs/vlclient.h34
-rw-r--r--fs/afs/vlocation.c102
-rw-r--r--fs/afs/vnode.c36
-rw-r--r--fs/afs/vnode.h36
-rw-r--r--fs/afs/volume.c58
-rw-r--r--fs/afs/volume.h52
36 files changed, 506 insertions, 906 deletions
diff --git a/fs/afs/Makefile b/fs/afs/Makefile
index 4029c9da4b86..8e7197379672 100644
--- a/fs/afs/Makefile
+++ b/fs/afs/Makefile
@@ -2,8 +2,6 @@
2# Makefile for Red Hat Linux AFS client. 2# Makefile for Red Hat Linux AFS client.
3# 3#
4 4
5#CFLAGS += -finstrument-functions
6
7kafs-objs := \ 5kafs-objs := \
8 callback.o \ 6 callback.o \
9 cell.o \ 7 cell.o \
diff --git a/fs/afs/cache.h b/fs/afs/cache.h
index 9eb7722b34d5..36a3642cf90e 100644
--- a/fs/afs/cache.h
+++ b/fs/afs/cache.h
@@ -1,4 +1,4 @@
1/* cache.h: AFS local cache management interface 1/* AFS local cache management interface
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_CACHE_H 12#ifndef AFS_CACHE_H
13#define _LINUX_AFS_CACHE_H 13#define AFS_CACHE_H
14 14
15#undef AFS_CACHING_SUPPORT 15#undef AFS_CACHING_SUPPORT
16 16
@@ -20,8 +20,4 @@
20#endif 20#endif
21#include "types.h" 21#include "types.h"
22 22
23#ifdef __KERNEL__ 23#endif /* AFS_CACHE_H */
24
25#endif /* __KERNEL__ */
26
27#endif /* _LINUX_AFS_CACHE_H */
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index 9cb206e9d4be..26a48fea42f4 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -21,7 +21,6 @@
21#include "internal.h" 21#include "internal.h"
22#include "cmservice.h" 22#include "cmservice.h"
23 23
24/*****************************************************************************/
25/* 24/*
26 * allow the fileserver to request callback state (re-)initialisation 25 * allow the fileserver to request callback state (re-)initialisation
27 */ 26 */
@@ -79,9 +78,8 @@ int SRXAFSCM_InitCallBackState(struct afs_server *server)
79 78
80 _leave(" = 0"); 79 _leave(" = 0");
81 return 0; 80 return 0;
82} /* end SRXAFSCM_InitCallBackState() */ 81}
83 82
84/*****************************************************************************/
85/* 83/*
86 * allow the fileserver to break callback promises 84 * allow the fileserver to break callback promises
87 */ 85 */
@@ -156,9 +154,8 @@ int SRXAFSCM_CallBack(struct afs_server *server, size_t count,
156 154
157 _leave(" = 0"); 155 _leave(" = 0");
158 return 0; 156 return 0;
159} /* end SRXAFSCM_CallBack() */ 157}
160 158
161/*****************************************************************************/
162/* 159/*
163 * allow the fileserver to see if the cache manager is still alive 160 * allow the fileserver to see if the cache manager is still alive
164 */ 161 */
@@ -166,4 +163,4 @@ int SRXAFSCM_Probe(struct afs_server *server)
166{ 163{
167 _debug("SRXAFSCM_Probe(%p)\n", server); 164 _debug("SRXAFSCM_Probe(%p)\n", server);
168 return 0; 165 return 0;
169} /* end SRXAFSCM_Probe() */ 166}
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 1fc578372759..28ed84ec8ff7 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -1,4 +1,4 @@
1/* cell.c: AFS cell and server record management 1/* AFS cell and server record management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -44,7 +44,6 @@ struct cachefs_index_def afs_cache_cell_index_def = {
44}; 44};
45#endif 45#endif
46 46
47/*****************************************************************************/
48/* 47/*
49 * create a cell record 48 * create a cell record
50 * - "name" is the name of the cell 49 * - "name" is the name of the cell
@@ -137,16 +136,15 @@ int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell)
137 _leave(" = 0 (%p)", cell); 136 _leave(" = 0 (%p)", cell);
138 return 0; 137 return 0;
139 138
140 badaddr: 139badaddr:
141 printk(KERN_ERR "kAFS: bad VL server IP address: '%s'\n", vllist); 140 printk(KERN_ERR "kAFS: bad VL server IP address: '%s'\n", vllist);
142 error: 141error:
143 up_write(&afs_cells_sem); 142 up_write(&afs_cells_sem);
144 kfree(cell); 143 kfree(cell);
145 _leave(" = %d", ret); 144 _leave(" = %d", ret);
146 return ret; 145 return ret;
147} /* end afs_cell_create() */ 146}
148 147
149/*****************************************************************************/
150/* 148/*
151 * initialise the cell database from module parameters 149 * initialise the cell database from module parameters
152 */ 150 */
@@ -199,10 +197,8 @@ int afs_cell_init(char *rootcell)
199 197
200 _leave(" = %d", ret); 198 _leave(" = %d", ret);
201 return ret; 199 return ret;
200}
202 201
203} /* end afs_cell_init() */
204
205/*****************************************************************************/
206/* 202/*
207 * lookup a cell record 203 * lookup a cell record
208 */ 204 */
@@ -234,8 +230,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
234 230
235 if (cell) 231 if (cell)
236 ret = 0; 232 ret = 0;
237 } 233 } else {
238 else {
239 read_lock(&afs_cells_lock); 234 read_lock(&afs_cells_lock);
240 235
241 cell = afs_cell_root; 236 cell = afs_cell_root;
@@ -247,8 +242,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
247 * for other reasons. 242 * for other reasons.
248 */ 243 */
249 ret = -EDESTADDRREQ; 244 ret = -EDESTADDRREQ;
250 } 245 } else {
251 else {
252 afs_get_cell(cell); 246 afs_get_cell(cell);
253 ret = 0; 247 ret = 0;
254 } 248 }
@@ -259,10 +253,8 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
259 *_cell = cell; 253 *_cell = cell;
260 _leave(" = %d (%p)", ret, cell); 254 _leave(" = %d (%p)", ret, cell);
261 return ret; 255 return ret;
256}
262 257
263} /* end afs_cell_lookup() */
264
265/*****************************************************************************/
266/* 258/*
267 * try and get a cell record 259 * try and get a cell record
268 */ 260 */
@@ -281,9 +273,8 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell)
281 write_unlock(&afs_cells_lock); 273 write_unlock(&afs_cells_lock);
282 274
283 return cell; 275 return cell;
284} /* end afs_get_cell_maybe() */ 276}
285 277
286/*****************************************************************************/
287/* 278/*
288 * destroy a cell record 279 * destroy a cell record
289 */ 280 */
@@ -315,9 +306,8 @@ void afs_put_cell(struct afs_cell *cell)
315 BUG_ON(!list_empty(&cell->vl_graveyard)); 306 BUG_ON(!list_empty(&cell->vl_graveyard));
316 307
317 _leave(" [unused]"); 308 _leave(" [unused]");
318} /* end afs_put_cell() */ 309}
319 310
320/*****************************************************************************/
321/* 311/*
322 * destroy a cell record 312 * destroy a cell record
323 */ 313 */
@@ -359,9 +349,8 @@ static void afs_cell_destroy(struct afs_cell *cell)
359 kfree(cell); 349 kfree(cell);
360 350
361 _leave(" [destroyed]"); 351 _leave(" [destroyed]");
362} /* end afs_cell_destroy() */ 352}
363 353
364/*****************************************************************************/
365/* 354/*
366 * lookup the server record corresponding to an Rx RPC peer 355 * lookup the server record corresponding to an Rx RPC peer
367 */ 356 */
@@ -411,7 +400,7 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
411 return -ENOENT; 400 return -ENOENT;
412 401
413 /* we found it in the graveyard - resurrect it */ 402 /* we found it in the graveyard - resurrect it */
414 found_dead_server: 403found_dead_server:
415 list_move_tail(&server->link, &cell->sv_list); 404 list_move_tail(&server->link, &cell->sv_list);
416 afs_get_server(server); 405 afs_get_server(server);
417 afs_kafstimod_del_timer(&server->timeout); 406 afs_kafstimod_del_timer(&server->timeout);
@@ -419,20 +408,18 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
419 goto success; 408 goto success;
420 409
421 /* we found it - increment its ref count and return it */ 410 /* we found it - increment its ref count and return it */
422 found_server: 411found_server:
423 afs_get_server(server); 412 afs_get_server(server);
424 413
425 success: 414success:
426 write_unlock(&cell->sv_lock); 415 write_unlock(&cell->sv_lock);
427 read_unlock(&afs_cells_lock); 416 read_unlock(&afs_cells_lock);
428 417
429 *_server = server; 418 *_server = server;
430 _leave(" = 0 (s=%p c=%p)", server, cell); 419 _leave(" = 0 (s=%p c=%p)", server, cell);
431 return 0; 420 return 0;
421}
432 422
433} /* end afs_server_find_by_peer() */
434
435/*****************************************************************************/
436/* 423/*
437 * purge in-memory cell database on module unload or afs_init() failure 424 * purge in-memory cell database on module unload or afs_init() failure
438 * - the timeout daemon is stopped before calling this 425 * - the timeout daemon is stopped before calling this
@@ -520,9 +507,8 @@ void afs_cell_purge(void)
520 } 507 }
521 508
522 _leave(""); 509 _leave("");
523} /* end afs_cell_purge() */ 510}
524 511
525/*****************************************************************************/
526/* 512/*
527 * match a cell record obtained from the cache 513 * match a cell record obtained from the cache
528 */ 514 */
@@ -542,10 +528,9 @@ static cachefs_match_val_t afs_cell_cache_match(void *target,
542 528
543 _leave(" = FAILED"); 529 _leave(" = FAILED");
544 return CACHEFS_MATCH_FAILED; 530 return CACHEFS_MATCH_FAILED;
545} /* end afs_cell_cache_match() */ 531}
546#endif 532#endif
547 533
548/*****************************************************************************/
549/* 534/*
550 * update a cell record in the cache 535 * update a cell record in the cache
551 */ 536 */
@@ -563,5 +548,5 @@ static void afs_cell_cache_update(void *source, void *entry)
563 cell->vl_addrs, 548 cell->vl_addrs,
564 min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs))); 549 min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs)));
565 550
566} /* end afs_cell_cache_update() */ 551}
567#endif 552#endif
diff --git a/fs/afs/cell.h b/fs/afs/cell.h
index 48349108fb00..c135b00c6c75 100644
--- a/fs/afs/cell.h
+++ b/fs/afs/cell.h
@@ -1,4 +1,4 @@
1/* cell.h: AFS cell record 1/* AFS cell record
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_CELL_H 12#ifndef AFS_CELL_H
13#define _LINUX_AFS_CELL_H 13#define AFS_CELL_H
14 14
15#include "types.h" 15#include "types.h"
16#include "cache.h" 16#include "cache.h"
@@ -19,22 +19,18 @@
19 19
20extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */ 20extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */
21 21
22/*****************************************************************************/
23/* 22/*
24 * entry in the cached cell catalogue 23 * entry in the cached cell catalogue
25 */ 24 */
26struct afs_cache_cell 25struct afs_cache_cell {
27{
28 char name[64]; /* cell name (padded with NULs) */ 26 char name[64]; /* cell name (padded with NULs) */
29 struct in_addr vl_servers[15]; /* cached cell VL servers */ 27 struct in_addr vl_servers[15]; /* cached cell VL servers */
30}; 28};
31 29
32/*****************************************************************************/
33/* 30/*
34 * AFS cell record 31 * AFS cell record
35 */ 32 */
36struct afs_cell 33struct afs_cell {
37{
38 atomic_t usage; 34 atomic_t usage;
39 struct list_head link; /* main cell list link */ 35 struct list_head link; /* main cell list link */
40 struct list_head proc_link; /* /proc cell list link */ 36 struct list_head proc_link; /* /proc cell list link */
@@ -61,18 +57,14 @@ struct afs_cell
61 char name[0]; /* cell name - must go last */ 57 char name[0]; /* cell name - must go last */
62}; 58};
63 59
64extern int afs_cell_init(char *rootcell); 60extern int afs_cell_init(char *);
65 61extern int afs_cell_create(const char *, char *, struct afs_cell **);
66extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell); 62extern int afs_cell_lookup(const char *, unsigned, struct afs_cell **);
67
68extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell);
69 63
70#define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0) 64#define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
71 65
72extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell); 66extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **);
73 67extern void afs_put_cell(struct afs_cell *);
74extern void afs_put_cell(struct afs_cell *cell);
75
76extern void afs_cell_purge(void); 68extern void afs_cell_purge(void);
77 69
78#endif /* _LINUX_AFS_CELL_H */ 70#endif /* AFS_CELL_H */
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3d097fddcb7a..3f4585765cbf 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -1,4 +1,4 @@
1/* cmservice.c: AFS Cache Manager Service 1/* AFS Cache Manager Service
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -106,7 +106,6 @@ static DEFINE_SPINLOCK(afscm_calls_lock);
106static DEFINE_SPINLOCK(kafscmd_attention_lock); 106static DEFINE_SPINLOCK(kafscmd_attention_lock);
107static int kafscmd_die; 107static int kafscmd_die;
108 108
109/*****************************************************************************/
110/* 109/*
111 * AFS Cache Manager kernel thread 110 * AFS Cache Manager kernel thread
112 */ 111 */
@@ -177,10 +176,8 @@ static int kafscmd(void *arg)
177 176
178 /* and that's all */ 177 /* and that's all */
179 complete_and_exit(&kafscmd_dead, 0); 178 complete_and_exit(&kafscmd_dead, 0);
179}
180 180
181} /* end kafscmd() */
182
183/*****************************************************************************/
184/* 181/*
185 * handle a call coming in to the cache manager 182 * handle a call coming in to the cache manager
186 * - if I want to keep the call, I must increment its usage count 183 * - if I want to keep the call, I must increment its usage count
@@ -202,10 +199,8 @@ static int afscm_new_call(struct rxrpc_call *call)
202 199
203 _leave(" = 0"); 200 _leave(" = 0");
204 return 0; 201 return 0;
202}
205 203
206} /* end afscm_new_call() */
207
208/*****************************************************************************/
209/* 204/*
210 * queue on the kafscmd queue for attention 205 * queue on the kafscmd queue for attention
211 */ 206 */
@@ -226,9 +221,8 @@ static void afscm_attention(struct rxrpc_call *call)
226 wake_up(&kafscmd_sleepq); 221 wake_up(&kafscmd_sleepq);
227 222
228 _leave(" {u=%d}", atomic_read(&call->usage)); 223 _leave(" {u=%d}", atomic_read(&call->usage));
229} /* end afscm_attention() */ 224}
230 225
231/*****************************************************************************/
232/* 226/*
233 * handle my call being aborted 227 * handle my call being aborted
234 * - clean up, dequeue and put my ref to the call 228 * - clean up, dequeue and put my ref to the call
@@ -266,9 +260,8 @@ static void afscm_error(struct rxrpc_call *call)
266 wake_up(&kafscmd_sleepq); 260 wake_up(&kafscmd_sleepq);
267 261
268 _leave(""); 262 _leave("");
269} /* end afscm_error() */ 263}
270 264
271/*****************************************************************************/
272/* 265/*
273 * map afs abort codes to/from Linux error codes 266 * map afs abort codes to/from Linux error codes
274 * - called with call->lock held 267 * - called with call->lock held
@@ -285,9 +278,8 @@ static void afscm_aemap(struct rxrpc_call *call)
285 default: 278 default:
286 break; 279 break;
287 } 280 }
288} /* end afscm_aemap() */ 281}
289 282
290/*****************************************************************************/
291/* 283/*
292 * start the cache manager service if not already started 284 * start the cache manager service if not already started
293 */ 285 */
@@ -316,18 +308,16 @@ int afscm_start(void)
316 308
317 return 0; 309 return 0;
318 310
319 kill: 311kill:
320 kafscmd_die = 1; 312 kafscmd_die = 1;
321 wake_up(&kafscmd_sleepq); 313 wake_up(&kafscmd_sleepq);
322 wait_for_completion(&kafscmd_dead); 314 wait_for_completion(&kafscmd_dead);
323 315
324 out: 316out:
325 up_write(&afscm_sem); 317 up_write(&afscm_sem);
326 return ret; 318 return ret;
319}
327 320
328} /* end afscm_start() */
329
330/*****************************************************************************/
331/* 321/*
332 * stop the cache manager service 322 * stop the cache manager service
333 */ 323 */
@@ -394,10 +384,8 @@ void afscm_stop(void)
394 } 384 }
395 385
396 up_write(&afscm_sem); 386 up_write(&afscm_sem);
387}
397 388
398} /* end afscm_stop() */
399
400/*****************************************************************************/
401/* 389/*
402 * handle the fileserver breaking a set of callbacks 390 * handle the fileserver breaking a set of callbacks
403 */ 391 */
@@ -460,8 +448,7 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
460 pcb->version = ntohl(*bp++); 448 pcb->version = ntohl(*bp++);
461 pcb->expiry = ntohl(*bp++); 449 pcb->expiry = ntohl(*bp++);
462 pcb->type = ntohl(*bp++); 450 pcb->type = ntohl(*bp++);
463 } 451 } else {
464 else {
465 pcb->version = 0; 452 pcb->version = 0;
466 pcb->expiry = 0; 453 pcb->expiry = 0;
467 pcb->type = AFSCM_CB_UNTYPED; 454 pcb->type = AFSCM_CB_UNTYPED;
@@ -512,10 +499,8 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
512 afs_put_server(server); 499 afs_put_server(server);
513 500
514 _leave(" = %d", ret); 501 _leave(" = %d", ret);
502}
515 503
516} /* end _SRXAFSCM_CallBack() */
517
518/*****************************************************************************/
519/* 504/*
520 * handle the fileserver asking us to initialise our callback state 505 * handle the fileserver asking us to initialise our callback state
521 */ 506 */
@@ -580,10 +565,8 @@ static void _SRXAFSCM_InitCallBackState(struct rxrpc_call *call)
580 afs_put_server(server); 565 afs_put_server(server);
581 566
582 _leave(" = %d", ret); 567 _leave(" = %d", ret);
568}
583 569
584} /* end _SRXAFSCM_InitCallBackState() */
585
586/*****************************************************************************/
587/* 570/*
588 * handle a probe from a fileserver 571 * handle a probe from a fileserver
589 */ 572 */
@@ -648,5 +631,4 @@ static void _SRXAFSCM_Probe(struct rxrpc_call *call)
648 afs_put_server(server); 631 afs_put_server(server);
649 632
650 _leave(" = %d", ret); 633 _leave(" = %d", ret);
651 634}
652} /* end _SRXAFSCM_Probe() */
diff --git a/fs/afs/cmservice.h b/fs/afs/cmservice.h
index af8d4d689cb2..66e10c15bd1b 100644
--- a/fs/afs/cmservice.h
+++ b/fs/afs/cmservice.h
@@ -1,4 +1,4 @@
1/* cmservice.h: AFS Cache Manager Service declarations 1/* AFS Cache Manager Service declarations
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_CMSERVICE_H 12#ifndef AFS_CMSERVICE_H
13#define _LINUX_AFS_CMSERVICE_H 13#define AFS_CMSERVICE_H
14 14
15#include <rxrpc/transport.h> 15#include <rxrpc/transport.h>
16#include "types.h" 16#include "types.h"
@@ -20,10 +20,9 @@ extern int afscm_start(void);
20extern void afscm_stop(void); 20extern void afscm_stop(void);
21 21
22/* cache manager server functions */ 22/* cache manager server functions */
23extern int SRXAFSCM_InitCallBackState(struct afs_server *server); 23extern int SRXAFSCM_InitCallBackState(struct afs_server *);
24extern int SRXAFSCM_CallBack(struct afs_server *server, 24extern int SRXAFSCM_CallBack(struct afs_server *, size_t,
25 size_t count, 25 struct afs_callback[]);
26 struct afs_callback callbacks[]); 26extern int SRXAFSCM_Probe(struct afs_server *);
27extern int SRXAFSCM_Probe(struct afs_server *server);
28 27
29#endif /* _LINUX_AFS_CMSERVICE_H */ 28#endif /* AFS_CMSERVICE_H */
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index b6dc2ebe47a8..2f6d92376461 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -112,7 +112,6 @@ struct afs_dir_lookup_cookie {
112 int found; 112 int found;
113}; 113};
114 114
115/*****************************************************************************/
116/* 115/*
117 * check that a directory page is valid 116 * check that a directory page is valid
118 */ 117 */
@@ -157,13 +156,11 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
157 SetPageChecked(page); 156 SetPageChecked(page);
158 return; 157 return;
159 158
160 error: 159error:
161 SetPageChecked(page); 160 SetPageChecked(page);
162 SetPageError(page); 161 SetPageError(page);
162}
163 163
164} /* end afs_dir_check_page() */
165
166/*****************************************************************************/
167/* 164/*
168 * discard a page cached in the pagecache 165 * discard a page cached in the pagecache
169 */ 166 */
@@ -171,10 +168,8 @@ static inline void afs_dir_put_page(struct page *page)
171{ 168{
172 kunmap(page); 169 kunmap(page);
173 page_cache_release(page); 170 page_cache_release(page);
171}
174 172
175} /* end afs_dir_put_page() */
176
177/*****************************************************************************/
178/* 173/*
179 * get a page into the pagecache 174 * get a page into the pagecache
180 */ 175 */
@@ -197,12 +192,11 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index)
197 } 192 }
198 return page; 193 return page;
199 194
200 fail: 195fail:
201 afs_dir_put_page(page); 196 afs_dir_put_page(page);
202 return ERR_PTR(-EIO); 197 return ERR_PTR(-EIO);
203} /* end afs_dir_get_page() */ 198}
204 199
205/*****************************************************************************/
206/* 200/*
207 * open an AFS directory file 201 * open an AFS directory file
208 */ 202 */
@@ -218,10 +212,8 @@ static int afs_dir_open(struct inode *inode, struct file *file)
218 212
219 _leave(" = 0"); 213 _leave(" = 0");
220 return 0; 214 return 0;
215}
221 216
222} /* end afs_dir_open() */
223
224/*****************************************************************************/
225/* 217/*
226 * deal with one block in an AFS directory 218 * deal with one block in an AFS directory
227 */ 219 */
@@ -316,9 +308,8 @@ static int afs_dir_iterate_block(unsigned *fpos,
316 308
317 _leave(" = 1 [more]"); 309 _leave(" = 1 [more]");
318 return 1; 310 return 1;
319} /* end afs_dir_iterate_block() */ 311}
320 312
321/*****************************************************************************/
322/* 313/*
323 * read an AFS directory 314 * read an AFS directory
324 */ 315 */
@@ -377,12 +368,11 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
377 ret = 0; 368 ret = 0;
378 } 369 }
379 370
380 out: 371out:
381 _leave(" = %d", ret); 372 _leave(" = %d", ret);
382 return ret; 373 return ret;
383} /* end afs_dir_iterate() */ 374}
384 375
385/*****************************************************************************/
386/* 376/*
387 * read an AFS directory 377 * read an AFS directory
388 */ 378 */
@@ -399,9 +389,8 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir)
399 389
400 _leave(" = %d", ret); 390 _leave(" = %d", ret);
401 return ret; 391 return ret;
402} /* end afs_dir_readdir() */ 392}
403 393
404/*****************************************************************************/
405/* 394/*
406 * search the directory for a name 395 * search the directory for a name
407 * - if afs_dir_iterate_block() spots this function, it'll pass the FID 396 * - if afs_dir_iterate_block() spots this function, it'll pass the FID
@@ -426,9 +415,8 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
426 415
427 _leave(" = -1 [found]"); 416 _leave(" = -1 [found]");
428 return -1; 417 return -1;
429} /* end afs_dir_lookup_filldir() */ 418}
430 419
431/*****************************************************************************/
432/* 420/*
433 * look up an entry in a directory 421 * look up an entry in a directory
434 */ 422 */
@@ -498,9 +486,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry,
498 dentry->d_inode->i_version); 486 dentry->d_inode->i_version);
499 487
500 return NULL; 488 return NULL;
501} /* end afs_dir_lookup() */ 489}
502 490
503/*****************************************************************************/
504/* 491/*
505 * check that a dentry lookup hit has found a valid entry 492 * check that a dentry lookup hit has found a valid entry
506 * - NOTE! the hit can be a negative hit too, so we can't assume we have an 493 * - NOTE! the hit can be a negative hit too, so we can't assume we have an
@@ -605,18 +592,18 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
605 (void *) (unsigned long) AFS_FS_I(dir)->status.version; 592 (void *) (unsigned long) AFS_FS_I(dir)->status.version;
606 } 593 }
607 594
608 out_valid: 595out_valid:
609 dput(parent); 596 dput(parent);
610 _leave(" = 1 [valid]"); 597 _leave(" = 1 [valid]");
611 return 1; 598 return 1;
612 599
613 /* the dirent, if it exists, now points to a different vnode */ 600 /* the dirent, if it exists, now points to a different vnode */
614 not_found: 601not_found:
615 spin_lock(&dentry->d_lock); 602 spin_lock(&dentry->d_lock);
616 dentry->d_flags |= DCACHE_NFSFS_RENAMED; 603 dentry->d_flags |= DCACHE_NFSFS_RENAMED;
617 spin_unlock(&dentry->d_lock); 604 spin_unlock(&dentry->d_lock);
618 605
619 out_bad: 606out_bad:
620 if (inode) { 607 if (inode) {
621 /* don't unhash if we have submounts */ 608 /* don't unhash if we have submounts */
622 if (have_submounts(dentry)) 609 if (have_submounts(dentry))
@@ -633,9 +620,8 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
633 620
634 _leave(" = 0 [bad]"); 621 _leave(" = 0 [bad]");
635 return 0; 622 return 0;
636} /* end afs_d_revalidate() */ 623}
637 624
638/*****************************************************************************/
639/* 625/*
640 * allow the VFS to enquire as to whether a dentry should be unhashed (mustn't 626 * allow the VFS to enquire as to whether a dentry should be unhashed (mustn't
641 * sleep) 627 * sleep)
@@ -657,7 +643,7 @@ static int afs_d_delete(struct dentry *dentry)
657 _leave(" = 0 [keep]"); 643 _leave(" = 0 [keep]");
658 return 0; 644 return 0;
659 645
660 zap: 646zap:
661 _leave(" = 1 [zap]"); 647 _leave(" = 1 [zap]");
662 return 1; 648 return 1;
663} /* end afs_d_delete() */ 649}
diff --git a/fs/afs/errors.h b/fs/afs/errors.h
index 574d94ac8d05..bcc0a3309e72 100644
--- a/fs/afs/errors.h
+++ b/fs/afs/errors.h
@@ -1,4 +1,4 @@
1/* errors.h: AFS abort/error codes 1/* AFS abort/error codes
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,12 +9,14 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_ERRORS_H 12#ifndef AFS_ERRORS_H
13#define _LINUX_AFS_ERRORS_H 13#define AFS_ERRORS_H
14 14
15#include "types.h" 15#include "types.h"
16 16
17/* file server abort codes */ 17/*
18 * file server abort codes
19 */
18typedef enum { 20typedef enum {
19 VSALVAGE = 101, /* volume needs salvaging */ 21 VSALVAGE = 101, /* volume needs salvaging */
20 VNOVNODE = 102, /* no such file/dir (vnode) */ 22 VNOVNODE = 102, /* no such file/dir (vnode) */
@@ -29,6 +31,6 @@ typedef enum {
29 VMOVED = 111, /* volume moved to new server - ask this FS where */ 31 VMOVED = 111, /* volume moved to new server - ask this FS where */
30} afs_rxfs_abort_t; 32} afs_rxfs_abort_t;
31 33
32extern int afs_abort_to_error(int abortcode); 34extern int afs_abort_to_error(int);
33 35
34#endif /* _LINUX_AFS_ERRORS_H */ 36#endif /* AFS_ERRORS_H */
diff --git a/fs/afs/file.c b/fs/afs/file.c
index b17634541f67..01df30d256b8 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -40,7 +40,6 @@ const struct address_space_operations afs_fs_aops = {
40 .invalidatepage = afs_file_invalidatepage, 40 .invalidatepage = afs_file_invalidatepage,
41}; 41};
42 42
43/*****************************************************************************/
44/* 43/*
45 * deal with notification that a page was read from the cache 44 * deal with notification that a page was read from the cache
46 */ 45 */
@@ -58,10 +57,9 @@ static void afs_file_readpage_read_complete(void *cookie_data,
58 SetPageUptodate(page); 57 SetPageUptodate(page);
59 unlock_page(page); 58 unlock_page(page);
60 59
61} /* end afs_file_readpage_read_complete() */ 60}
62#endif 61#endif
63 62
64/*****************************************************************************/
65/* 63/*
66 * deal with notification that a page was written to the cache 64 * deal with notification that a page was written to the cache
67 */ 65 */
@@ -74,11 +72,9 @@ static void afs_file_readpage_write_complete(void *cookie_data,
74 _enter("%p,%p,%p,%d", cookie_data, page, data, error); 72 _enter("%p,%p,%p,%d", cookie_data, page, data, error);
75 73
76 unlock_page(page); 74 unlock_page(page);
77 75}
78} /* end afs_file_readpage_write_complete() */
79#endif 76#endif
80 77
81/*****************************************************************************/
82/* 78/*
83 * AFS read page from file (or symlink) 79 * AFS read page from file (or symlink)
84 */ 80 */
@@ -184,10 +180,8 @@ static int afs_file_readpage(struct file *file, struct page *page)
184 180
185 _leave(" = %d", ret); 181 _leave(" = %d", ret);
186 return ret; 182 return ret;
183}
187 184
188} /* end afs_file_readpage() */
189
190/*****************************************************************************/
191/* 185/*
192 * get a page cookie for the specified page 186 * get a page cookie for the specified page
193 */ 187 */
@@ -202,10 +196,9 @@ int afs_cache_get_page_cookie(struct page *page,
202 196
203 _leave(" = %d", ret); 197 _leave(" = %d", ret);
204 return ret; 198 return ret;
205} /* end afs_cache_get_page_cookie() */ 199}
206#endif 200#endif
207 201
208/*****************************************************************************/
209/* 202/*
210 * invalidate part or all of a page 203 * invalidate part or all of a page
211 */ 204 */
@@ -240,9 +233,8 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset)
240 } 233 }
241 234
242 _leave(" = %d", ret); 235 _leave(" = %d", ret);
243} /* end afs_file_invalidatepage() */ 236}
244 237
245/*****************************************************************************/
246/* 238/*
247 * release a page and cleanup its private data 239 * release a page and cleanup its private data
248 */ 240 */
@@ -267,4 +259,4 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
267 259
268 _leave(" = 0"); 260 _leave(" = 0");
269 return 0; 261 return 0;
270} /* end afs_file_releasepage() */ 262}
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index 61bc371532ab..f1c3a186842e 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -29,7 +29,6 @@
29#define FSGETROOTVOLUME 151 /* AFS Get root volume name */ 29#define FSGETROOTVOLUME 151 /* AFS Get root volume name */
30#define FSLOOKUP 161 /* AFS lookup file in directory */ 30#define FSLOOKUP 161 /* AFS lookup file in directory */
31 31
32/*****************************************************************************/
33/* 32/*
34 * map afs abort codes to/from Linux error codes 33 * map afs abort codes to/from Linux error codes
35 * - called with call->lock held 34 * - called with call->lock held
@@ -46,9 +45,8 @@ static void afs_rxfs_aemap(struct rxrpc_call *call)
46 default: 45 default:
47 break; 46 break;
48 } 47 }
49} /* end afs_rxfs_aemap() */ 48}
50 49
51/*****************************************************************************/
52/* 50/*
53 * get the root volume name from a fileserver 51 * get the root volume name from a fileserver
54 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2 52 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
@@ -162,23 +160,22 @@ int afs_rxfs_get_root_volume(struct afs_server *server,
162 BUG(); 160 BUG();
163 } 161 }
164 162
165 abort: 163abort:
166 set_current_state(TASK_UNINTERRUPTIBLE); 164 set_current_state(TASK_UNINTERRUPTIBLE);
167 rxrpc_call_abort(call, ret); 165 rxrpc_call_abort(call, ret);
168 schedule(); 166 schedule();
169 out_unwait: 167out_unwait:
170 set_current_state(TASK_RUNNING); 168 set_current_state(TASK_RUNNING);
171 remove_wait_queue(&call->waitq, &myself); 169 remove_wait_queue(&call->waitq, &myself);
172 rxrpc_put_call(call); 170 rxrpc_put_call(call);
173 out_put_conn: 171out_put_conn:
174 afs_server_release_fsconn(server, conn); 172 afs_server_release_fsconn(server, conn);
175 out: 173out:
176 kleave(""); 174 kleave("");
177 return ret; 175 return ret;
178} /* end afs_rxfs_get_root_volume() */ 176}
179#endif 177#endif
180 178
181/*****************************************************************************/
182/* 179/*
183 * get information about a volume 180 * get information about a volume
184 */ 181 */
@@ -275,26 +272,24 @@ int afs_rxfs_get_volume_info(struct afs_server *server,
275 /* success */ 272 /* success */
276 ret = 0; 273 ret = 0;
277 274
278 out_unwait: 275out_unwait:
279 set_current_state(TASK_RUNNING); 276 set_current_state(TASK_RUNNING);
280 remove_wait_queue(&call->waitq, &myself); 277 remove_wait_queue(&call->waitq, &myself);
281 rxrpc_put_call(call); 278 rxrpc_put_call(call);
282 out_put_conn: 279out_put_conn:
283 afs_server_release_fsconn(server, conn); 280 afs_server_release_fsconn(server, conn);
284 out: 281out:
285 _leave(""); 282 _leave("");
286 return ret; 283 return ret;
287 284
288 abort: 285abort:
289 set_current_state(TASK_UNINTERRUPTIBLE); 286 set_current_state(TASK_UNINTERRUPTIBLE);
290 rxrpc_call_abort(call, ret); 287 rxrpc_call_abort(call, ret);
291 schedule(); 288 schedule();
292 goto out_unwait; 289 goto out_unwait;
293 290}
294} /* end afs_rxfs_get_volume_info() */
295#endif 291#endif
296 292
297/*****************************************************************************/
298/* 293/*
299 * fetch the status information for a file 294 * fetch the status information for a file
300 */ 295 */
@@ -401,24 +396,23 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
401 /* success */ 396 /* success */
402 ret = 0; 397 ret = 0;
403 398
404 out_unwait: 399out_unwait:
405 set_current_state(TASK_RUNNING); 400 set_current_state(TASK_RUNNING);
406 remove_wait_queue(&call->waitq, &myself); 401 remove_wait_queue(&call->waitq, &myself);
407 rxrpc_put_call(call); 402 rxrpc_put_call(call);
408 out_put_conn: 403out_put_conn:
409 afs_server_release_callslot(server, &callslot); 404 afs_server_release_callslot(server, &callslot);
410 out: 405out:
411 _leave(""); 406 _leave("");
412 return ret; 407 return ret;
413 408
414 abort: 409abort:
415 set_current_state(TASK_UNINTERRUPTIBLE); 410 set_current_state(TASK_UNINTERRUPTIBLE);
416 rxrpc_call_abort(call, ret); 411 rxrpc_call_abort(call, ret);
417 schedule(); 412 schedule();
418 goto out_unwait; 413 goto out_unwait;
419} /* end afs_rxfs_fetch_file_status() */ 414}
420 415
421/*****************************************************************************/
422/* 416/*
423 * fetch the contents of a file or directory 417 * fetch the contents of a file or directory
424 */ 418 */
@@ -547,31 +541,29 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
547 /* success */ 541 /* success */
548 ret = 0; 542 ret = 0;
549 543
550 out_unwait: 544out_unwait:
551 set_current_state(TASK_RUNNING); 545 set_current_state(TASK_RUNNING);
552 remove_wait_queue(&call->waitq,&myself); 546 remove_wait_queue(&call->waitq,&myself);
553 rxrpc_put_call(call); 547 rxrpc_put_call(call);
554 out_put_conn: 548out_put_conn:
555 afs_server_release_callslot(server, &callslot); 549 afs_server_release_callslot(server, &callslot);
556 out: 550out:
557 _leave(" = %d", ret); 551 _leave(" = %d", ret);
558 return ret; 552 return ret;
559 553
560 read_failed: 554read_failed:
561 if (ret == -ECONNABORTED) { 555 if (ret == -ECONNABORTED) {
562 ret = call->app_errno; 556 ret = call->app_errno;
563 goto out_unwait; 557 goto out_unwait;
564 } 558 }
565 559
566 abort: 560abort:
567 set_current_state(TASK_UNINTERRUPTIBLE); 561 set_current_state(TASK_UNINTERRUPTIBLE);
568 rxrpc_call_abort(call, ret); 562 rxrpc_call_abort(call, ret);
569 schedule(); 563 schedule();
570 goto out_unwait; 564 goto out_unwait;
565}
571 566
572} /* end afs_rxfs_fetch_file_data() */
573
574/*****************************************************************************/
575/* 567/*
576 * ask the AFS fileserver to discard a callback request on a file 568 * ask the AFS fileserver to discard a callback request on a file
577 */ 569 */
@@ -655,24 +647,23 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
655 BUG(); 647 BUG();
656 } 648 }
657 649
658 out_unwait: 650out_unwait:
659 set_current_state(TASK_RUNNING); 651 set_current_state(TASK_RUNNING);
660 remove_wait_queue(&call->waitq, &myself); 652 remove_wait_queue(&call->waitq, &myself);
661 rxrpc_put_call(call); 653 rxrpc_put_call(call);
662 out_put_conn: 654out_put_conn:
663 afs_server_release_callslot(server, &callslot); 655 afs_server_release_callslot(server, &callslot);
664 out: 656out:
665 _leave(""); 657 _leave("");
666 return ret; 658 return ret;
667 659
668 abort: 660abort:
669 set_current_state(TASK_UNINTERRUPTIBLE); 661 set_current_state(TASK_UNINTERRUPTIBLE);
670 rxrpc_call_abort(call, ret); 662 rxrpc_call_abort(call, ret);
671 schedule(); 663 schedule();
672 goto out_unwait; 664 goto out_unwait;
673} /* end afs_rxfs_give_up_callback() */ 665}
674 666
675/*****************************************************************************/
676/* 667/*
677 * look a filename up in a directory 668 * look a filename up in a directory
678 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2 669 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
@@ -818,20 +809,20 @@ int afs_rxfs_lookup(struct afs_server *server,
818 /* success */ 809 /* success */
819 ret = 0; 810 ret = 0;
820 811
821 out_unwait: 812out_unwait:
822 set_current_state(TASK_RUNNING); 813 set_current_state(TASK_RUNNING);
823 remove_wait_queue(&call->waitq, &myself); 814 remove_wait_queue(&call->waitq, &myself);
824 rxrpc_put_call(call); 815 rxrpc_put_call(call);
825 out_put_conn: 816out_put_conn:
826 afs_server_release_fsconn(server, conn); 817 afs_server_release_fsconn(server, conn);
827 out: 818out:
828 kleave(""); 819 kleave("");
829 return ret; 820 return ret;
830 821
831 abort: 822abort:
832 set_current_state(TASK_UNINTERRUPTIBLE); 823 set_current_state(TASK_UNINTERRUPTIBLE);
833 rxrpc_call_abort(call, ret); 824 rxrpc_call_abort(call, ret);
834 schedule(); 825 schedule();
835 goto out_unwait; 826 goto out_unwait;
836} /* end afs_rxfs_lookup() */ 827}
837#endif 828#endif
diff --git a/fs/afs/fsclient.h b/fs/afs/fsclient.h
index 8ba3e749ee3c..e2b0b7bcd09d 100644
--- a/fs/afs/fsclient.h
+++ b/fs/afs/fsclient.h
@@ -1,4 +1,4 @@
1/* fsclient.h: AFS File Server client stub declarations 1/* AFS File Server client stub declarations
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,18 +9,18 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_FSCLIENT_H 12#ifndef AFS_FSCLIENT_H
13#define _LINUX_AFS_FSCLIENT_H 13#define AFS_FSCLIENT_H
14 14
15#include "server.h" 15#include "server.h"
16 16
17extern int afs_rxfs_get_volume_info(struct afs_server *server, 17extern int afs_rxfs_get_volume_info(struct afs_server *,
18 const char *name, 18 const char *,
19 struct afs_volume_info *vinfo); 19 struct afs_volume_info *);
20 20
21extern int afs_rxfs_fetch_file_status(struct afs_server *server, 21extern int afs_rxfs_fetch_file_status(struct afs_server *,
22 struct afs_vnode *vnode, 22 struct afs_vnode *,
23 struct afs_volsync *volsync); 23 struct afs_volsync *);
24 24
25struct afs_rxfs_fetch_descriptor { 25struct afs_rxfs_fetch_descriptor {
26 struct afs_fid fid; /* file ID to fetch */ 26 struct afs_fid fid; /* file ID to fetch */
@@ -30,25 +30,25 @@ struct afs_rxfs_fetch_descriptor {
30 size_t actual; /* actual size sent back by server */ 30 size_t actual; /* actual size sent back by server */
31}; 31};
32 32
33extern int afs_rxfs_fetch_file_data(struct afs_server *server, 33extern int afs_rxfs_fetch_file_data(struct afs_server *,
34 struct afs_vnode *vnode, 34 struct afs_vnode *,
35 struct afs_rxfs_fetch_descriptor *desc, 35 struct afs_rxfs_fetch_descriptor *,
36 struct afs_volsync *volsync); 36 struct afs_volsync *);
37 37
38extern int afs_rxfs_give_up_callback(struct afs_server *server, 38extern int afs_rxfs_give_up_callback(struct afs_server *,
39 struct afs_vnode *vnode); 39 struct afs_vnode *);
40 40
41/* this doesn't appear to work in OpenAFS server */ 41/* this doesn't appear to work in OpenAFS server */
42extern int afs_rxfs_lookup(struct afs_server *server, 42extern int afs_rxfs_lookup(struct afs_server *,
43 struct afs_vnode *dir, 43 struct afs_vnode *,
44 const char *filename, 44 const char *,
45 struct afs_vnode *vnode, 45 struct afs_vnode *,
46 struct afs_volsync *volsync); 46 struct afs_volsync *);
47 47
48/* this is apparently mis-implemented in OpenAFS server */ 48/* this is apparently mis-implemented in OpenAFS server */
49extern int afs_rxfs_get_root_volume(struct afs_server *server, 49extern int afs_rxfs_get_root_volume(struct afs_server *,
50 char *buf, 50 char *,
51 size_t *buflen); 51 size_t *);
52 52
53 53
54#endif /* _LINUX_AFS_FSCLIENT_H */ 54#endif /* AFS_FSCLIENT_H */
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 9d9bca6c28b5..900c8bb1c3b8 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -29,7 +29,6 @@ struct afs_iget_data {
29 struct afs_volume *volume; /* volume on which resides */ 29 struct afs_volume *volume; /* volume on which resides */
30}; 30};
31 31
32/*****************************************************************************/
33/* 32/*
34 * map the AFS file status to the inode member variables 33 * map the AFS file status to the inode member variables
35 */ 34 */
@@ -87,9 +86,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode)
87 } 86 }
88 87
89 return 0; 88 return 0;
90} /* end afs_inode_map_status() */ 89}
91 90
92/*****************************************************************************/
93/* 91/*
94 * attempt to fetch the status of an inode, coelescing multiple simultaneous 92 * attempt to fetch the status of an inode, coelescing multiple simultaneous
95 * fetches 93 * fetches
@@ -107,10 +105,8 @@ static int afs_inode_fetch_status(struct inode *inode)
107 ret = afs_inode_map_status(vnode); 105 ret = afs_inode_map_status(vnode);
108 106
109 return ret; 107 return ret;
108}
110 109
111} /* end afs_inode_fetch_status() */
112
113/*****************************************************************************/
114/* 110/*
115 * iget5() comparator 111 * iget5() comparator
116 */ 112 */
@@ -120,9 +116,8 @@ static int afs_iget5_test(struct inode *inode, void *opaque)
120 116
121 return inode->i_ino == data->fid.vnode && 117 return inode->i_ino == data->fid.vnode &&
122 inode->i_version == data->fid.unique; 118 inode->i_version == data->fid.unique;
123} /* end afs_iget5_test() */ 119}
124 120
125/*****************************************************************************/
126/* 121/*
127 * iget5() inode initialiser 122 * iget5() inode initialiser
128 */ 123 */
@@ -137,9 +132,8 @@ static int afs_iget5_set(struct inode *inode, void *opaque)
137 vnode->volume = data->volume; 132 vnode->volume = data->volume;
138 133
139 return 0; 134 return 0;
140} /* end afs_iget5_set() */ 135}
141 136
142/*****************************************************************************/
143/* 137/*
144 * inode retrieval 138 * inode retrieval
145 */ 139 */
@@ -169,7 +163,7 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
169 /* deal with an existing inode */ 163 /* deal with an existing inode */
170 if (!(inode->i_state & I_NEW)) { 164 if (!(inode->i_state & I_NEW)) {
171 ret = afs_vnode_fetch_status(vnode); 165 ret = afs_vnode_fetch_status(vnode);
172 if (ret==0) 166 if (ret == 0)
173 *_inode = inode; 167 *_inode = inode;
174 else 168 else
175 iput(inode); 169 iput(inode);
@@ -204,16 +198,15 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
204 return 0; 198 return 0;
205 199
206 /* failure */ 200 /* failure */
207 bad_inode: 201bad_inode:
208 make_bad_inode(inode); 202 make_bad_inode(inode);
209 unlock_new_inode(inode); 203 unlock_new_inode(inode);
210 iput(inode); 204 iput(inode);
211 205
212 _leave(" = %d [bad]", ret); 206 _leave(" = %d [bad]", ret);
213 return ret; 207 return ret;
214} /* end afs_iget() */ 208}
215 209
216/*****************************************************************************/
217/* 210/*
218 * read the attributes of an inode 211 * read the attributes of an inode
219 */ 212 */
@@ -235,8 +228,7 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
235 _leave(" = %d [%d %p]", 228 _leave(" = %d [%d %p]",
236 ret, atomic_read(&dentry->d_count), dentry->d_inode); 229 ret, atomic_read(&dentry->d_count), dentry->d_inode);
237 return ret; 230 return ret;
238 } 231 } else if (ret < 0) {
239 else if (ret < 0) {
240 make_bad_inode(inode); 232 make_bad_inode(inode);
241 _leave(" = %d", ret); 233 _leave(" = %d", ret);
242 return ret; 234 return ret;
@@ -252,9 +244,8 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
252 vnode->cb_type); 244 vnode->cb_type);
253 245
254 return 0; 246 return 0;
255} /* end afs_inode_getattr() */ 247}
256 248
257/*****************************************************************************/
258/* 249/*
259 * clear an AFS inode 250 * clear an AFS inode
260 */ 251 */
@@ -282,4 +273,4 @@ void afs_clear_inode(struct inode *inode)
282#endif 273#endif
283 274
284 _leave(""); 275 _leave("");
285} /* end afs_clear_inode() */ 276}
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 5151d5da2c2f..b6dd20a93cce 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -1,4 +1,4 @@
1/* internal.h: internal AFS stuff 1/* internal AFS stuff
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -73,26 +73,16 @@ extern const struct address_space_operations afs_fs_aops;
73extern const struct inode_operations afs_file_inode_operations; 73extern const struct inode_operations afs_file_inode_operations;
74 74
75#ifdef AFS_CACHING_SUPPORT 75#ifdef AFS_CACHING_SUPPORT
76extern int afs_cache_get_page_cookie(struct page *page, 76extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **);
77 struct cachefs_page **_page_cookie);
78#endif 77#endif
79 78
80/* 79/*
81 * inode.c 80 * inode.c
82 */ 81 */
83extern int afs_iget(struct super_block *sb, struct afs_fid *fid, 82extern int afs_iget(struct super_block *, struct afs_fid *, struct inode **);
84 struct inode **_inode); 83extern int afs_inode_getattr(struct vfsmount *, struct dentry *,
85extern int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, 84 struct kstat *);
86 struct kstat *stat); 85extern void afs_clear_inode(struct inode *);
87extern void afs_clear_inode(struct inode *inode);
88
89/*
90 * key_afs.c
91 */
92#ifdef CONFIG_KEYS
93extern int afs_key_register(void);
94extern void afs_key_unregister(void);
95#endif
96 86
97/* 87/*
98 * main.c 88 * main.c
@@ -110,7 +100,7 @@ extern struct afs_timer afs_mntpt_expiry_timer;
110extern struct afs_timer_ops afs_mntpt_expiry_timer_ops; 100extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
111extern unsigned long afs_mntpt_expiry_timeout; 101extern unsigned long afs_mntpt_expiry_timeout;
112 102
113extern int afs_mntpt_check_symlink(struct afs_vnode *vnode); 103extern int afs_mntpt_check_symlink(struct afs_vnode *);
114 104
115/* 105/*
116 * super.c 106 * super.c
@@ -123,17 +113,17 @@ extern void afs_fs_exit(void);
123extern struct list_head afs_cb_hash_tbl[]; 113extern struct list_head afs_cb_hash_tbl[];
124extern spinlock_t afs_cb_hash_lock; 114extern spinlock_t afs_cb_hash_lock;
125 115
126#define afs_cb_hash(SRV,FID) \ 116#define afs_cb_hash(SRV, FID) \
127 afs_cb_hash_tbl[((unsigned long)(SRV) + \ 117 afs_cb_hash_tbl[((unsigned long)(SRV) + \
128 (FID)->vid + (FID)->vnode + (FID)->unique) % \ 118 (FID)->vid + (FID)->vnode + (FID)->unique) & \
129 AFS_CB_HASH_COUNT] 119 (AFS_CB_HASH_COUNT - 1)]
130 120
131/* 121/*
132 * proc.c 122 * proc.c
133 */ 123 */
134extern int afs_proc_init(void); 124extern int afs_proc_init(void);
135extern void afs_proc_cleanup(void); 125extern void afs_proc_cleanup(void);
136extern int afs_proc_cell_setup(struct afs_cell *cell); 126extern int afs_proc_cell_setup(struct afs_cell *);
137extern void afs_proc_cell_remove(struct afs_cell *cell); 127extern void afs_proc_cell_remove(struct afs_cell *);
138 128
139#endif /* AFS_INTERNAL_H */ 129#endif /* AFS_INTERNAL_H */
diff --git a/fs/afs/kafsasyncd.c b/fs/afs/kafsasyncd.c
index 615df2407cb2..8ca01c236013 100644
--- a/fs/afs/kafsasyncd.c
+++ b/fs/afs/kafsasyncd.c
@@ -1,4 +1,4 @@
1/* kafsasyncd.c: AFS asynchronous operation daemon 1/* AFS asynchronous operation daemon
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -50,7 +50,6 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call)
50{ 50{
51} 51}
52 52
53/*****************************************************************************/
54/* 53/*
55 * start the async daemon 54 * start the async daemon
56 */ 55 */
@@ -65,9 +64,8 @@ int afs_kafsasyncd_start(void)
65 wait_for_completion(&kafsasyncd_alive); 64 wait_for_completion(&kafsasyncd_alive);
66 65
67 return ret; 66 return ret;
68} /* end afs_kafsasyncd_start() */ 67}
69 68
70/*****************************************************************************/
71/* 69/*
72 * stop the async daemon 70 * stop the async daemon
73 */ 71 */
@@ -77,10 +75,8 @@ void afs_kafsasyncd_stop(void)
77 kafsasyncd_die = 1; 75 kafsasyncd_die = 1;
78 wake_up(&kafsasyncd_sleepq); 76 wake_up(&kafsasyncd_sleepq);
79 wait_for_completion(&kafsasyncd_dead); 77 wait_for_completion(&kafsasyncd_dead);
78}
80 79
81} /* end afs_kafsasyncd_stop() */
82
83/*****************************************************************************/
84/* 80/*
85 * probing daemon 81 * probing daemon
86 */ 82 */
@@ -187,10 +183,8 @@ static int kafsasyncd(void *arg)
187 /* and that's all */ 183 /* and that's all */
188 _leave(""); 184 _leave("");
189 complete_and_exit(&kafsasyncd_dead, 0); 185 complete_and_exit(&kafsasyncd_dead, 0);
186}
190 187
191} /* end kafsasyncd() */
192
193/*****************************************************************************/
194/* 188/*
195 * begin an operation 189 * begin an operation
196 * - place operation on busy queue 190 * - place operation on busy queue
@@ -209,9 +203,8 @@ void afs_kafsasyncd_begin_op(struct afs_async_op *op)
209 spin_unlock(&kafsasyncd_async_lock); 203 spin_unlock(&kafsasyncd_async_lock);
210 204
211 _leave(""); 205 _leave("");
212} /* end afs_kafsasyncd_begin_op() */ 206}
213 207
214/*****************************************************************************/
215/* 208/*
216 * request attention for an operation 209 * request attention for an operation
217 * - move to attention queue 210 * - move to attention queue
@@ -229,9 +222,8 @@ void afs_kafsasyncd_attend_op(struct afs_async_op *op)
229 wake_up(&kafsasyncd_sleepq); 222 wake_up(&kafsasyncd_sleepq);
230 223
231 _leave(""); 224 _leave("");
232} /* end afs_kafsasyncd_attend_op() */ 225}
233 226
234/*****************************************************************************/
235/* 227/*
236 * terminate an operation 228 * terminate an operation
237 * - remove from either queue 229 * - remove from either queue
@@ -252,4 +244,4 @@ void afs_kafsasyncd_terminate_op(struct afs_async_op *op)
252 wake_up(&kafsasyncd_sleepq); 244 wake_up(&kafsasyncd_sleepq);
253 245
254 _leave(""); 246 _leave("");
255} /* end afs_kafsasyncd_terminate_op() */ 247}
diff --git a/fs/afs/kafsasyncd.h b/fs/afs/kafsasyncd.h
index 791803f9a6fb..1273eb544c56 100644
--- a/fs/afs/kafsasyncd.h
+++ b/fs/afs/kafsasyncd.h
@@ -1,4 +1,4 @@
1/* kafsasyncd.h: AFS asynchronous operation daemon 1/* AFS asynchronous operation daemon
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,24 +9,22 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_KAFSASYNCD_H 12#ifndef AFS_KAFSASYNCD_H
13#define _LINUX_AFS_KAFSASYNCD_H 13#define AFS_KAFSASYNCD_H
14 14
15#include "types.h" 15#include "types.h"
16 16
17struct afs_async_op; 17struct afs_async_op;
18 18
19struct afs_async_op_ops { 19struct afs_async_op_ops {
20 void (*attend)(struct afs_async_op *op); 20 void (*attend)(struct afs_async_op *);
21 void (*discard)(struct afs_async_op *op); 21 void (*discard)(struct afs_async_op *);
22}; 22};
23 23
24/*****************************************************************************/
25/* 24/*
26 * asynchronous operation record 25 * asynchronous operation record
27 */ 26 */
28struct afs_async_op 27struct afs_async_op {
29{
30 struct list_head link; 28 struct list_head link;
31 struct afs_server *server; /* server being contacted */ 29 struct afs_server *server; /* server being contacted */
32 struct rxrpc_call *call; /* RxRPC call performing op */ 30 struct rxrpc_call *call; /* RxRPC call performing op */
@@ -45,8 +43,8 @@ static inline void afs_async_op_init(struct afs_async_op *op,
45extern int afs_kafsasyncd_start(void); 43extern int afs_kafsasyncd_start(void);
46extern void afs_kafsasyncd_stop(void); 44extern void afs_kafsasyncd_stop(void);
47 45
48extern void afs_kafsasyncd_begin_op(struct afs_async_op *op); 46extern void afs_kafsasyncd_begin_op(struct afs_async_op *);
49extern void afs_kafsasyncd_attend_op(struct afs_async_op *op); 47extern void afs_kafsasyncd_attend_op(struct afs_async_op *);
50extern void afs_kafsasyncd_terminate_op(struct afs_async_op *op); 48extern void afs_kafsasyncd_terminate_op(struct afs_async_op *);
51 49
52#endif /* _LINUX_AFS_KAFSASYNCD_H */ 50#endif /* AFS_KAFSASYNCD_H */
diff --git a/fs/afs/kafstimod.c b/fs/afs/kafstimod.c
index 694344e4d3c7..3526dcccc163 100644
--- a/fs/afs/kafstimod.c
+++ b/fs/afs/kafstimod.c
@@ -1,4 +1,4 @@
1/* kafstimod.c: AFS timeout daemon 1/* AFS timeout daemon
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -30,7 +30,6 @@ static DEFINE_SPINLOCK(kafstimod_lock);
30 30
31static int kafstimod(void *arg); 31static int kafstimod(void *arg);
32 32
33/*****************************************************************************/
34/* 33/*
35 * start the timeout daemon 34 * start the timeout daemon
36 */ 35 */
@@ -45,9 +44,8 @@ int afs_kafstimod_start(void)
45 wait_for_completion(&kafstimod_alive); 44 wait_for_completion(&kafstimod_alive);
46 45
47 return ret; 46 return ret;
48} /* end afs_kafstimod_start() */ 47}
49 48
50/*****************************************************************************/
51/* 49/*
52 * stop the timeout daemon 50 * stop the timeout daemon
53 */ 51 */
@@ -57,10 +55,8 @@ void afs_kafstimod_stop(void)
57 kafstimod_die = 1; 55 kafstimod_die = 1;
58 wake_up(&kafstimod_sleepq); 56 wake_up(&kafstimod_sleepq);
59 wait_for_completion(&kafstimod_dead); 57 wait_for_completion(&kafstimod_dead);
58}
60 59
61} /* end afs_kafstimod_stop() */
62
63/*****************************************************************************/
64/* 60/*
65 * timeout processing daemon 61 * timeout processing daemon
66 */ 62 */
@@ -77,7 +73,7 @@ static int kafstimod(void *arg)
77 complete(&kafstimod_alive); 73 complete(&kafstimod_alive);
78 74
79 /* loop around looking for things to attend to */ 75 /* loop around looking for things to attend to */
80 loop: 76loop:
81 set_current_state(TASK_INTERRUPTIBLE); 77 set_current_state(TASK_INTERRUPTIBLE);
82 add_wait_queue(&kafstimod_sleepq, &myself); 78 add_wait_queue(&kafstimod_sleepq, &myself);
83 79
@@ -101,8 +97,7 @@ static int kafstimod(void *arg)
101 spin_lock(&kafstimod_lock); 97 spin_lock(&kafstimod_lock);
102 if (list_empty(&kafstimod_list)) { 98 if (list_empty(&kafstimod_list)) {
103 timeout = MAX_SCHEDULE_TIMEOUT; 99 timeout = MAX_SCHEDULE_TIMEOUT;
104 } 100 } else {
105 else {
106 timer = list_entry(kafstimod_list.next, 101 timer = list_entry(kafstimod_list.next,
107 struct afs_timer, link); 102 struct afs_timer, link);
108 timeout = timer->timo_jif; 103 timeout = timer->timo_jif;
@@ -110,10 +105,7 @@ static int kafstimod(void *arg)
110 105
111 if (time_before_eq((unsigned long) timeout, jif)) 106 if (time_before_eq((unsigned long) timeout, jif))
112 goto immediate; 107 goto immediate;
113 108 timeout = (long) timeout - (long) jiffies;
114 else {
115 timeout = (long) timeout - (long) jiffies;
116 }
117 } 109 }
118 spin_unlock(&kafstimod_lock); 110 spin_unlock(&kafstimod_lock);
119 111
@@ -126,7 +118,7 @@ static int kafstimod(void *arg)
126 * - we come here with the lock held and timer pointing to the expired 118 * - we come here with the lock held and timer pointing to the expired
127 * entry 119 * entry
128 */ 120 */
129 immediate: 121immediate:
130 remove_wait_queue(&kafstimod_sleepq, &myself); 122 remove_wait_queue(&kafstimod_sleepq, &myself);
131 set_current_state(TASK_RUNNING); 123 set_current_state(TASK_RUNNING);
132 124
@@ -141,10 +133,8 @@ static int kafstimod(void *arg)
141 133
142 _debug("@@@ End Timeout"); 134 _debug("@@@ End Timeout");
143 goto loop; 135 goto loop;
136}
144 137
145} /* end kafstimod() */
146
147/*****************************************************************************/
148/* 138/*
149 * (re-)queue a timer 139 * (re-)queue a timer
150 */ 140 */
@@ -176,9 +166,8 @@ void afs_kafstimod_add_timer(struct afs_timer *timer, unsigned long timeout)
176 wake_up(&kafstimod_sleepq); 166 wake_up(&kafstimod_sleepq);
177 167
178 _leave(""); 168 _leave("");
179} /* end afs_kafstimod_add_timer() */ 169}
180 170
181/*****************************************************************************/
182/* 171/*
183 * dequeue a timer 172 * dequeue a timer
184 * - returns 0 if the timer was deleted or -ENOENT if it wasn't queued 173 * - returns 0 if the timer was deleted or -ENOENT if it wasn't queued
@@ -202,4 +191,4 @@ int afs_kafstimod_del_timer(struct afs_timer *timer)
202 191
203 _leave(" = %d", ret); 192 _leave(" = %d", ret);
204 return ret; 193 return ret;
205} /* end afs_kafstimod_del_timer() */ 194}
diff --git a/fs/afs/kafstimod.h b/fs/afs/kafstimod.h
index e312f1a61a7f..0d39becbbe02 100644
--- a/fs/afs/kafstimod.h
+++ b/fs/afs/kafstimod.h
@@ -1,4 +1,4 @@
1/* kafstimod.h: AFS timeout daemon 1/* AFS timeout daemon
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_KAFSTIMOD_H 12#ifndef AFS_KAFSTIMOD_H
13#define _LINUX_AFS_KAFSTIMOD_H 13#define AFS_KAFSTIMOD_H
14 14
15#include "types.h" 15#include "types.h"
16 16
@@ -18,15 +18,13 @@ struct afs_timer;
18 18
19struct afs_timer_ops { 19struct afs_timer_ops {
20 /* called when the front of the timer queue has timed out */ 20 /* called when the front of the timer queue has timed out */
21 void (*timed_out)(struct afs_timer *timer); 21 void (*timed_out)(struct afs_timer *);
22}; 22};
23 23
24/*****************************************************************************/
25/* 24/*
26 * AFS timer/timeout record 25 * AFS timer/timeout record
27 */ 26 */
28struct afs_timer 27struct afs_timer {
29{
30 struct list_head link; /* link in timer queue */ 28 struct list_head link; /* link in timer queue */
31 unsigned long timo_jif; /* timeout time */ 29 unsigned long timo_jif; /* timeout time */
32 const struct afs_timer_ops *ops; /* timeout expiry function */ 30 const struct afs_timer_ops *ops; /* timeout expiry function */
@@ -41,9 +39,7 @@ static inline void afs_timer_init(struct afs_timer *timer,
41 39
42extern int afs_kafstimod_start(void); 40extern int afs_kafstimod_start(void);
43extern void afs_kafstimod_stop(void); 41extern void afs_kafstimod_stop(void);
42extern void afs_kafstimod_add_timer(struct afs_timer *, unsigned long);
43extern int afs_kafstimod_del_timer(struct afs_timer *);
44 44
45extern void afs_kafstimod_add_timer(struct afs_timer *timer, 45#endif /* AFS_KAFSTIMOD_H */
46 unsigned long timeout);
47extern int afs_kafstimod_del_timer(struct afs_timer *timer);
48
49#endif /* _LINUX_AFS_KAFSTIMOD_H */
diff --git a/fs/afs/main.c b/fs/afs/main.c
index f2704ba53857..5bf39f66f4ce 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -1,4 +1,4 @@
1/* main.c: AFS client file system 1/* AFS client file system
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -62,7 +62,6 @@ struct cachefs_netfs afs_cache_netfs = {
62}; 62};
63#endif 63#endif
64 64
65/*****************************************************************************/
66/* 65/*
67 * initialise the AFS client FS module 66 * initialise the AFS client FS module
68 */ 67 */
@@ -87,70 +86,61 @@ static int __init afs_init(void)
87 ret = cachefs_register_netfs(&afs_cache_netfs, 86 ret = cachefs_register_netfs(&afs_cache_netfs,
88 &afs_cache_cell_index_def); 87 &afs_cache_cell_index_def);
89 if (ret < 0) 88 if (ret < 0)
90 goto error;
91#endif
92
93#ifdef CONFIG_KEYS_TURNED_OFF
94 ret = afs_key_register();
95 if (ret < 0)
96 goto error_cache; 89 goto error_cache;
97#endif 90#endif
98 91
99 /* initialise the cell DB */ 92 /* initialise the cell DB */
100 ret = afs_cell_init(rootcell); 93 ret = afs_cell_init(rootcell);
101 if (ret < 0) 94 if (ret < 0)
102 goto error_keys; 95 goto error_cell_init;
103 96
104 /* start the timeout daemon */ 97 /* start the timeout daemon */
105 ret = afs_kafstimod_start(); 98 ret = afs_kafstimod_start();
106 if (ret < 0) 99 if (ret < 0)
107 goto error_keys; 100 goto error_kafstimod;
108 101
109 /* start the async operation daemon */ 102 /* start the async operation daemon */
110 ret = afs_kafsasyncd_start(); 103 ret = afs_kafsasyncd_start();
111 if (ret < 0) 104 if (ret < 0)
112 goto error_kafstimod; 105 goto error_kafsasyncd;
113 106
114 /* create the RxRPC transport */ 107 /* create the RxRPC transport */
115 ret = rxrpc_create_transport(7001, &afs_transport); 108 ret = rxrpc_create_transport(7001, &afs_transport);
116 if (ret < 0) 109 if (ret < 0)
117 goto error_kafsasyncd; 110 goto error_transport;
118 111
119 afs_transport->peer_ops = &afs_peer_ops; 112 afs_transport->peer_ops = &afs_peer_ops;
120 113
121 /* register the filesystems */ 114 /* register the filesystems */
122 ret = afs_fs_init(); 115 ret = afs_fs_init();
123 if (ret < 0) 116 if (ret < 0)
124 goto error_transport; 117 goto error_fs;
125 118
126 return ret; 119 return ret;
127 120
128 error_transport: 121error_fs:
129 rxrpc_put_transport(afs_transport); 122 rxrpc_put_transport(afs_transport);
130 error_kafsasyncd: 123error_transport:
131 afs_kafsasyncd_stop(); 124 afs_kafsasyncd_stop();
132 error_kafstimod: 125error_kafsasyncd:
133 afs_kafstimod_stop(); 126 afs_kafstimod_stop();
134 error_keys: 127error_kafstimod:
135#ifdef CONFIG_KEYS_TURNED_OFF 128error_cell_init:
136 afs_key_unregister();
137 error_cache:
138#endif
139#ifdef AFS_CACHING_SUPPORT 129#ifdef AFS_CACHING_SUPPORT
140 cachefs_unregister_netfs(&afs_cache_netfs); 130 cachefs_unregister_netfs(&afs_cache_netfs);
141 error: 131error_cache:
142#endif 132#endif
143 afs_cell_purge(); 133 afs_cell_purge();
144 afs_proc_cleanup(); 134 afs_proc_cleanup();
145 printk(KERN_ERR "kAFS: failed to register: %d\n", ret); 135 printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
146 return ret; 136 return ret;
147} /* end afs_init() */ 137}
148 138
149/* XXX late_initcall is kludgy, but the only alternative seems to create 139/* XXX late_initcall is kludgy, but the only alternative seems to create
150 * a transport upon the first mount, which is worse. Or is it? 140 * a transport upon the first mount, which is worse. Or is it?
151 */ 141 */
152late_initcall(afs_init); /* must be called after net/ to create socket */ 142late_initcall(afs_init); /* must be called after net/ to create socket */
153/*****************************************************************************/ 143
154/* 144/*
155 * clean up on module removal 145 * clean up on module removal
156 */ 146 */
@@ -163,19 +153,14 @@ static void __exit afs_exit(void)
163 afs_kafstimod_stop(); 153 afs_kafstimod_stop();
164 afs_kafsasyncd_stop(); 154 afs_kafsasyncd_stop();
165 afs_cell_purge(); 155 afs_cell_purge();
166#ifdef CONFIG_KEYS_TURNED_OFF
167 afs_key_unregister();
168#endif
169#ifdef AFS_CACHING_SUPPORT 156#ifdef AFS_CACHING_SUPPORT
170 cachefs_unregister_netfs(&afs_cache_netfs); 157 cachefs_unregister_netfs(&afs_cache_netfs);
171#endif 158#endif
172 afs_proc_cleanup(); 159 afs_proc_cleanup();
173 160}
174} /* end afs_exit() */
175 161
176module_exit(afs_exit); 162module_exit(afs_exit);
177 163
178/*****************************************************************************/
179/* 164/*
180 * notification that new peer record is being added 165 * notification that new peer record is being added
181 * - called from krxsecd 166 * - called from krxsecd
@@ -208,9 +193,8 @@ static int afs_adding_peer(struct rxrpc_peer *peer)
208 afs_put_server(server); 193 afs_put_server(server);
209 194
210 return 0; 195 return 0;
211} /* end afs_adding_peer() */ 196}
212 197
213/*****************************************************************************/
214/* 198/*
215 * notification that a peer record is being discarded 199 * notification that a peer record is being discarded
216 * - called from krxiod or krxsecd 200 * - called from krxiod or krxsecd
@@ -236,50 +220,4 @@ static void afs_discarding_peer(struct rxrpc_peer *peer)
236 spin_unlock(&afs_server_peer_lock); 220 spin_unlock(&afs_server_peer_lock);
237 221
238 _leave(""); 222 _leave("");
239
240} /* end afs_discarding_peer() */
241
242/*****************************************************************************/
243/*
244 * clear the dead space between task_struct and kernel stack
245 * - called by supplying -finstrument-functions to gcc
246 */
247#if 0
248void __cyg_profile_func_enter (void *this_fn, void *call_site)
249__attribute__((no_instrument_function));
250
251void __cyg_profile_func_enter (void *this_fn, void *call_site)
252{
253 asm volatile(" movl %%esp,%%edi \n"
254 " andl %0,%%edi \n"
255 " addl %1,%%edi \n"
256 " movl %%esp,%%ecx \n"
257 " subl %%edi,%%ecx \n"
258 " shrl $2,%%ecx \n"
259 " movl $0xedededed,%%eax \n"
260 " rep stosl \n"
261 :
262 : "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
263 : "eax", "ecx", "edi", "memory", "cc"
264 );
265}
266
267void __cyg_profile_func_exit(void *this_fn, void *call_site)
268__attribute__((no_instrument_function));
269
270void __cyg_profile_func_exit(void *this_fn, void *call_site)
271{
272 asm volatile(" movl %%esp,%%edi \n"
273 " andl %0,%%edi \n"
274 " addl %1,%%edi \n"
275 " movl %%esp,%%ecx \n"
276 " subl %%edi,%%ecx \n"
277 " shrl $2,%%ecx \n"
278 " movl $0xdadadada,%%eax \n"
279 " rep stosl \n"
280 :
281 : "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
282 : "eax", "ecx", "edi", "memory", "cc"
283 );
284} 223}
285#endif
diff --git a/fs/afs/misc.c b/fs/afs/misc.c
index e4fce66d76e0..55bc6778cec7 100644
--- a/fs/afs/misc.c
+++ b/fs/afs/misc.c
@@ -1,4 +1,4 @@
1/* misc.c: miscellaneous bits 1/* miscellaneous bits
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -15,7 +15,6 @@
15#include "errors.h" 15#include "errors.h"
16#include "internal.h" 16#include "internal.h"
17 17
18/*****************************************************************************/
19/* 18/*
20 * convert an AFS abort code to a Linux error number 19 * convert an AFS abort code to a Linux error number
21 */ 20 */
@@ -35,5 +34,4 @@ int afs_abort_to_error(int abortcode)
35 case VMOVED: return -ENXIO; 34 case VMOVED: return -ENXIO;
36 default: return -EIO; 35 default: return -EIO;
37 } 36 }
38 37}
39} /* end afs_abort_to_error() */
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 68495f0de7b3..ca3fa81b068a 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -1,4 +1,4 @@
1/* mntpt.c: mountpoint management 1/* mountpoint management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -54,7 +54,6 @@ struct afs_timer afs_mntpt_expiry_timer;
54 54
55unsigned long afs_mntpt_expiry_timeout = 20; 55unsigned long afs_mntpt_expiry_timeout = 20;
56 56
57/*****************************************************************************/
58/* 57/*
59 * check a symbolic link to see whether it actually encodes a mountpoint 58 * check a symbolic link to see whether it actually encodes a mountpoint
60 * - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately 59 * - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately
@@ -99,16 +98,14 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode)
99 98
100 ret = 0; 99 ret = 0;
101 100
102 out_free: 101out_free:
103 kunmap(page); 102 kunmap(page);
104 page_cache_release(page); 103 page_cache_release(page);
105 out: 104out:
106 _leave(" = %d", ret); 105 _leave(" = %d", ret);
107 return ret; 106 return ret;
107}
108 108
109} /* end afs_mntpt_check_symlink() */
110
111/*****************************************************************************/
112/* 109/*
113 * no valid lookup procedure on this sort of dir 110 * no valid lookup procedure on this sort of dir
114 */ 111 */
@@ -125,9 +122,8 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
125 dentry->d_name.name); 122 dentry->d_name.name);
126 123
127 return ERR_PTR(-EREMOTE); 124 return ERR_PTR(-EREMOTE);
128} /* end afs_mntpt_lookup() */ 125}
129 126
130/*****************************************************************************/
131/* 127/*
132 * no valid open procedure on this sort of dir 128 * no valid open procedure on this sort of dir
133 */ 129 */
@@ -142,9 +138,8 @@ static int afs_mntpt_open(struct inode *inode, struct file *file)
142 file->f_path.dentry->d_name.name); 138 file->f_path.dentry->d_name.name);
143 139
144 return -EREMOTE; 140 return -EREMOTE;
145} /* end afs_mntpt_open() */ 141}
146 142
147/*****************************************************************************/
148/* 143/*
149 * create a vfsmount to be automounted 144 * create a vfsmount to be automounted
150 */ 145 */
@@ -210,7 +205,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
210 kleave(" = %p", mnt); 205 kleave(" = %p", mnt);
211 return mnt; 206 return mnt;
212 207
213 error: 208error:
214 if (page) 209 if (page)
215 page_cache_release(page); 210 page_cache_release(page);
216 if (devname) 211 if (devname)
@@ -219,9 +214,8 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
219 free_page((unsigned long) options); 214 free_page((unsigned long) options);
220 kleave(" = %d", ret); 215 kleave(" = %d", ret);
221 return ERR_PTR(ret); 216 return ERR_PTR(ret);
222} /* end afs_mntpt_do_automount() */ 217}
223 218
224/*****************************************************************************/
225/* 219/*
226 * follow a link from a mountpoint directory, thus causing it to be mounted 220 * follow a link from a mountpoint directory, thus causing it to be mounted
227 */ 221 */
@@ -260,9 +254,8 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
260 254
261 kleave(" = %d", err); 255 kleave(" = %d", err);
262 return ERR_PTR(err); 256 return ERR_PTR(err);
263} /* end afs_mntpt_follow_link() */ 257}
264 258
265/*****************************************************************************/
266/* 259/*
267 * handle mountpoint expiry timer going off 260 * handle mountpoint expiry timer going off
268 */ 261 */
@@ -276,4 +269,4 @@ static void afs_mntpt_expiry_timed_out(struct afs_timer *timer)
276 afs_mntpt_expiry_timeout * HZ); 269 afs_mntpt_expiry_timeout * HZ);
277 270
278 kleave(""); 271 kleave("");
279} /* end afs_mntpt_expiry_timed_out() */ 272}
diff --git a/fs/afs/mount.h b/fs/afs/mount.h
index 9d2f46ec549f..41b848320e08 100644
--- a/fs/afs/mount.h
+++ b/fs/afs/mount.h
@@ -1,4 +1,4 @@
1/* mount.h: mount parameters 1/* mount parameters
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_MOUNT_H 12#ifndef AFS_MOUNT_H
13#define _LINUX_AFS_MOUNT_H 13#define AFS_MOUNT_H
14 14
15struct afs_mountdata { 15struct afs_mountdata {
16 const char *volume; /* name of volume */ 16 const char *volume; /* name of volume */
@@ -20,4 +20,4 @@ struct afs_mountdata {
20 uint32_t servers[10]; /* IP addresses of servers in this cell */ 20 uint32_t servers[10]; /* IP addresses of servers in this cell */
21}; 21};
22 22
23#endif /* _LINUX_AFS_MOUNT_H */ 23#endif /* AFS_MOUNT_H */
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index ae6b85b1e484..5ebcc0cd3dd3 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -1,4 +1,4 @@
1/* proc.c: /proc interface for AFS 1/* /proc interface for AFS
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -130,7 +130,6 @@ static const struct file_operations afs_proc_cell_servers_fops = {
130 .release = afs_proc_cell_servers_release, 130 .release = afs_proc_cell_servers_release,
131}; 131};
132 132
133/*****************************************************************************/
134/* 133/*
135 * initialise the /proc/fs/afs/ directory 134 * initialise the /proc/fs/afs/ directory
136 */ 135 */
@@ -142,47 +141,43 @@ int afs_proc_init(void)
142 141
143 proc_afs = proc_mkdir("fs/afs", NULL); 142 proc_afs = proc_mkdir("fs/afs", NULL);
144 if (!proc_afs) 143 if (!proc_afs)
145 goto error; 144 goto error_dir;
146 proc_afs->owner = THIS_MODULE; 145 proc_afs->owner = THIS_MODULE;
147 146
148 p = create_proc_entry("cells", 0, proc_afs); 147 p = create_proc_entry("cells", 0, proc_afs);
149 if (!p) 148 if (!p)
150 goto error_proc; 149 goto error_cells;
151 p->proc_fops = &afs_proc_cells_fops; 150 p->proc_fops = &afs_proc_cells_fops;
152 p->owner = THIS_MODULE; 151 p->owner = THIS_MODULE;
153 152
154 p = create_proc_entry("rootcell", 0, proc_afs); 153 p = create_proc_entry("rootcell", 0, proc_afs);
155 if (!p) 154 if (!p)
156 goto error_cells; 155 goto error_rootcell;
157 p->proc_fops = &afs_proc_rootcell_fops; 156 p->proc_fops = &afs_proc_rootcell_fops;
158 p->owner = THIS_MODULE; 157 p->owner = THIS_MODULE;
159 158
160 _leave(" = 0"); 159 _leave(" = 0");
161 return 0; 160 return 0;
162 161
163 error_cells: 162error_rootcell:
164 remove_proc_entry("cells", proc_afs); 163 remove_proc_entry("cells", proc_afs);
165 error_proc: 164error_cells:
166 remove_proc_entry("fs/afs", NULL); 165 remove_proc_entry("fs/afs", NULL);
167 error: 166error_dir:
168 _leave(" = -ENOMEM"); 167 _leave(" = -ENOMEM");
169 return -ENOMEM; 168 return -ENOMEM;
169}
170 170
171} /* end afs_proc_init() */
172
173/*****************************************************************************/
174/* 171/*
175 * clean up the /proc/fs/afs/ directory 172 * clean up the /proc/fs/afs/ directory
176 */ 173 */
177void afs_proc_cleanup(void) 174void afs_proc_cleanup(void)
178{ 175{
176 remove_proc_entry("rootcell", proc_afs);
179 remove_proc_entry("cells", proc_afs); 177 remove_proc_entry("cells", proc_afs);
180
181 remove_proc_entry("fs/afs", NULL); 178 remove_proc_entry("fs/afs", NULL);
179}
182 180
183} /* end afs_proc_cleanup() */
184
185/*****************************************************************************/
186/* 181/*
187 * open "/proc/fs/afs/cells" which provides a summary of extant cells 182 * open "/proc/fs/afs/cells" which provides a summary of extant cells
188 */ 183 */
@@ -199,9 +194,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file)
199 m->private = PDE(inode)->data; 194 m->private = PDE(inode)->data;
200 195
201 return 0; 196 return 0;
202} /* end afs_proc_cells_open() */ 197}
203 198
204/*****************************************************************************/
205/* 199/*
206 * set up the iterator to start reading from the cells list and return the 200 * set up the iterator to start reading from the cells list and return the
207 * first item 201 * first item
@@ -225,9 +219,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos)
225 break; 219 break;
226 220
227 return _p != &afs_proc_cells ? _p : NULL; 221 return _p != &afs_proc_cells ? _p : NULL;
228} /* end afs_proc_cells_start() */ 222}
229 223
230/*****************************************************************************/
231/* 224/*
232 * move to next cell in cells list 225 * move to next cell in cells list
233 */ 226 */
@@ -241,19 +234,16 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos)
241 _p = v == (void *) 1 ? afs_proc_cells.next : _p->next; 234 _p = v == (void *) 1 ? afs_proc_cells.next : _p->next;
242 235
243 return _p != &afs_proc_cells ? _p : NULL; 236 return _p != &afs_proc_cells ? _p : NULL;
244} /* end afs_proc_cells_next() */ 237}
245 238
246/*****************************************************************************/
247/* 239/*
248 * clean up after reading from the cells list 240 * clean up after reading from the cells list
249 */ 241 */
250static void afs_proc_cells_stop(struct seq_file *p, void *v) 242static void afs_proc_cells_stop(struct seq_file *p, void *v)
251{ 243{
252 up_read(&afs_proc_cells_sem); 244 up_read(&afs_proc_cells_sem);
245}
253 246
254} /* end afs_proc_cells_stop() */
255
256/*****************************************************************************/
257/* 247/*
258 * display a header line followed by a load of cell lines 248 * display a header line followed by a load of cell lines
259 */ 249 */
@@ -261,19 +251,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
261{ 251{
262 struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); 252 struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link);
263 253
264 /* display header on line 1 */
265 if (v == (void *) 1) { 254 if (v == (void *) 1) {
255 /* display header on line 1 */
266 seq_puts(m, "USE NAME\n"); 256 seq_puts(m, "USE NAME\n");
267 return 0; 257 return 0;
268 } 258 }
269 259
270 /* display one cell per line on subsequent lines */ 260 /* display one cell per line on subsequent lines */
271 seq_printf(m, "%3d %s\n", atomic_read(&cell->usage), cell->name); 261 seq_printf(m, "%3d %s\n",
272 262 atomic_read(&cell->usage), cell->name);
273 return 0; 263 return 0;
274} /* end afs_proc_cells_show() */ 264}
275 265
276/*****************************************************************************/
277/* 266/*
278 * handle writes to /proc/fs/afs/cells 267 * handle writes to /proc/fs/afs/cells
279 * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" 268 * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
@@ -331,25 +320,23 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
331 goto done; 320 goto done;
332 321
333 printk("kAFS: Added new cell '%s'\n", name); 322 printk("kAFS: Added new cell '%s'\n", name);
334 } 323 } else {
335 else {
336 goto inval; 324 goto inval;
337 } 325 }
338 326
339 ret = size; 327 ret = size;
340 328
341 done: 329done:
342 kfree(kbuf); 330 kfree(kbuf);
343 _leave(" = %d", ret); 331 _leave(" = %d", ret);
344 return ret; 332 return ret;
345 333
346 inval: 334inval:
347 ret = -EINVAL; 335 ret = -EINVAL;
348 printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n"); 336 printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n");
349 goto done; 337 goto done;
350} /* end afs_proc_cells_write() */ 338}
351 339
352/*****************************************************************************/
353/* 340/*
354 * Stubs for /proc/fs/afs/rootcell 341 * Stubs for /proc/fs/afs/rootcell
355 */ 342 */
@@ -369,7 +356,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
369 return 0; 356 return 0;
370} 357}
371 358
372/*****************************************************************************/
373/* 359/*
374 * handle writes to /proc/fs/afs/rootcell 360 * handle writes to /proc/fs/afs/rootcell
375 * - to initialize rootcell: echo "cell.name:192.168.231.14" 361 * - to initialize rootcell: echo "cell.name:192.168.231.14"
@@ -407,14 +393,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
407 if (ret >= 0) 393 if (ret >= 0)
408 ret = size; /* consume everything, always */ 394 ret = size; /* consume everything, always */
409 395
410 infault: 396infault:
411 kfree(kbuf); 397 kfree(kbuf);
412 nomem: 398nomem:
413 _leave(" = %d", ret); 399 _leave(" = %d", ret);
414 return ret; 400 return ret;
415} /* end afs_proc_rootcell_write() */ 401}
416 402
417/*****************************************************************************/
418/* 403/*
419 * initialise /proc/fs/afs/<cell>/ 404 * initialise /proc/fs/afs/<cell>/
420 */ 405 */
@@ -426,25 +411,25 @@ int afs_proc_cell_setup(struct afs_cell *cell)
426 411
427 cell->proc_dir = proc_mkdir(cell->name, proc_afs); 412 cell->proc_dir = proc_mkdir(cell->name, proc_afs);
428 if (!cell->proc_dir) 413 if (!cell->proc_dir)
429 return -ENOMEM; 414 goto error_dir;
430 415
431 p = create_proc_entry("servers", 0, cell->proc_dir); 416 p = create_proc_entry("servers", 0, cell->proc_dir);
432 if (!p) 417 if (!p)
433 goto error_proc; 418 goto error_servers;
434 p->proc_fops = &afs_proc_cell_servers_fops; 419 p->proc_fops = &afs_proc_cell_servers_fops;
435 p->owner = THIS_MODULE; 420 p->owner = THIS_MODULE;
436 p->data = cell; 421 p->data = cell;
437 422
438 p = create_proc_entry("vlservers", 0, cell->proc_dir); 423 p = create_proc_entry("vlservers", 0, cell->proc_dir);
439 if (!p) 424 if (!p)
440 goto error_servers; 425 goto error_vlservers;
441 p->proc_fops = &afs_proc_cell_vlservers_fops; 426 p->proc_fops = &afs_proc_cell_vlservers_fops;
442 p->owner = THIS_MODULE; 427 p->owner = THIS_MODULE;
443 p->data = cell; 428 p->data = cell;
444 429
445 p = create_proc_entry("volumes", 0, cell->proc_dir); 430 p = create_proc_entry("volumes", 0, cell->proc_dir);
446 if (!p) 431 if (!p)
447 goto error_vlservers; 432 goto error_volumes;
448 p->proc_fops = &afs_proc_cell_volumes_fops; 433 p->proc_fops = &afs_proc_cell_volumes_fops;
449 p->owner = THIS_MODULE; 434 p->owner = THIS_MODULE;
450 p->data = cell; 435 p->data = cell;
@@ -452,17 +437,17 @@ int afs_proc_cell_setup(struct afs_cell *cell)
452 _leave(" = 0"); 437 _leave(" = 0");
453 return 0; 438 return 0;
454 439
455 error_vlservers: 440error_volumes:
456 remove_proc_entry("vlservers", cell->proc_dir); 441 remove_proc_entry("vlservers", cell->proc_dir);
457 error_servers: 442error_vlservers:
458 remove_proc_entry("servers", cell->proc_dir); 443 remove_proc_entry("servers", cell->proc_dir);
459 error_proc: 444error_servers:
460 remove_proc_entry(cell->name, proc_afs); 445 remove_proc_entry(cell->name, proc_afs);
446error_dir:
461 _leave(" = -ENOMEM"); 447 _leave(" = -ENOMEM");
462 return -ENOMEM; 448 return -ENOMEM;
463} /* end afs_proc_cell_setup() */ 449}
464 450
465/*****************************************************************************/
466/* 451/*
467 * remove /proc/fs/afs/<cell>/ 452 * remove /proc/fs/afs/<cell>/
468 */ 453 */
@@ -476,9 +461,8 @@ void afs_proc_cell_remove(struct afs_cell *cell)
476 remove_proc_entry(cell->name, proc_afs); 461 remove_proc_entry(cell->name, proc_afs);
477 462
478 _leave(""); 463 _leave("");
479} /* end afs_proc_cell_remove() */ 464}
480 465
481/*****************************************************************************/
482/* 466/*
483 * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells 467 * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells
484 */ 468 */
@@ -500,9 +484,8 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
500 m->private = cell; 484 m->private = cell;
501 485
502 return 0; 486 return 0;
503} /* end afs_proc_cell_volumes_open() */ 487}
504 488
505/*****************************************************************************/
506/* 489/*
507 * close the file and release the ref to the cell 490 * close the file and release the ref to the cell
508 */ 491 */
@@ -511,14 +494,12 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
511 struct afs_cell *cell = PDE(inode)->data; 494 struct afs_cell *cell = PDE(inode)->data;
512 int ret; 495 int ret;
513 496
514 ret = seq_release(inode,file); 497 ret = seq_release(inode, file);
515 498
516 afs_put_cell(cell); 499 afs_put_cell(cell);
517
518 return ret; 500 return ret;
519} /* end afs_proc_cell_volumes_release() */ 501}
520 502
521/*****************************************************************************/
522/* 503/*
523 * set up the iterator to start reading from the cells list and return the 504 * set up the iterator to start reading from the cells list and return the
524 * first item 505 * first item
@@ -545,9 +526,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos)
545 break; 526 break;
546 527
547 return _p != &cell->vl_list ? _p : NULL; 528 return _p != &cell->vl_list ? _p : NULL;
548} /* end afs_proc_cell_volumes_start() */ 529}
549 530
550/*****************************************************************************/
551/* 531/*
552 * move to next cell in cells list 532 * move to next cell in cells list
553 */ 533 */
@@ -562,12 +542,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v,
562 (*_pos)++; 542 (*_pos)++;
563 543
564 _p = v; 544 _p = v;
565 _p = v == (void *) 1 ? cell->vl_list.next : _p->next; 545 _p = (v == (void *) 1) ? cell->vl_list.next : _p->next;
566 546
567 return _p != &cell->vl_list ? _p : NULL; 547 return (_p != &cell->vl_list) ? _p : NULL;
568} /* end afs_proc_cell_volumes_next() */ 548}
569 549
570/*****************************************************************************/
571/* 550/*
572 * clean up after reading from the cells list 551 * clean up after reading from the cells list
573 */ 552 */
@@ -576,10 +555,8 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
576 struct afs_cell *cell = p->private; 555 struct afs_cell *cell = p->private;
577 556
578 up_read(&cell->vl_sem); 557 up_read(&cell->vl_sem);
558}
579 559
580} /* end afs_proc_cell_volumes_stop() */
581
582/*****************************************************************************/
583/* 560/*
584 * display a header line followed by a load of volume lines 561 * display a header line followed by a load of volume lines
585 */ 562 */
@@ -600,13 +577,11 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)
600 vlocation->vldb.vid[0], 577 vlocation->vldb.vid[0],
601 vlocation->vldb.vid[1], 578 vlocation->vldb.vid[1],
602 vlocation->vldb.vid[2], 579 vlocation->vldb.vid[2],
603 vlocation->vldb.name 580 vlocation->vldb.name);
604 );
605 581
606 return 0; 582 return 0;
607} /* end afs_proc_cell_volumes_show() */ 583}
608 584
609/*****************************************************************************/
610/* 585/*
611 * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume 586 * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume
612 * location server 587 * location server
@@ -629,9 +604,8 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
629 m->private = cell; 604 m->private = cell;
630 605
631 return 0; 606 return 0;
632} /* end afs_proc_cell_vlservers_open() */ 607}
633 608
634/*****************************************************************************/
635/* 609/*
636 * close the file and release the ref to the cell 610 * close the file and release the ref to the cell
637 */ 611 */
@@ -644,11 +618,9 @@ static int afs_proc_cell_vlservers_release(struct inode *inode,
644 ret = seq_release(inode,file); 618 ret = seq_release(inode,file);
645 619
646 afs_put_cell(cell); 620 afs_put_cell(cell);
647
648 return ret; 621 return ret;
649} /* end afs_proc_cell_vlservers_release() */ 622}
650 623
651/*****************************************************************************/
652/* 624/*
653 * set up the iterator to start reading from the cells list and return the 625 * set up the iterator to start reading from the cells list and return the
654 * first item 626 * first item
@@ -672,9 +644,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos)
672 return NULL; 644 return NULL;
673 645
674 return &cell->vl_addrs[pos]; 646 return &cell->vl_addrs[pos];
675} /* end afs_proc_cell_vlservers_start() */ 647}
676 648
677/*****************************************************************************/
678/* 649/*
679 * move to next cell in cells list 650 * move to next cell in cells list
680 */ 651 */
@@ -692,9 +663,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v,
692 return NULL; 663 return NULL;
693 664
694 return &cell->vl_addrs[pos]; 665 return &cell->vl_addrs[pos];
695} /* end afs_proc_cell_vlservers_next() */ 666}
696 667
697/*****************************************************************************/
698/* 668/*
699 * clean up after reading from the cells list 669 * clean up after reading from the cells list
700 */ 670 */
@@ -703,10 +673,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
703 struct afs_cell *cell = p->private; 673 struct afs_cell *cell = p->private;
704 674
705 up_read(&cell->vl_sem); 675 up_read(&cell->vl_sem);
676}
706 677
707} /* end afs_proc_cell_vlservers_stop() */
708
709/*****************************************************************************/
710/* 678/*
711 * display a header line followed by a load of volume lines 679 * display a header line followed by a load of volume lines
712 */ 680 */
@@ -722,11 +690,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
722 690
723 /* display one cell per line on subsequent lines */ 691 /* display one cell per line on subsequent lines */
724 seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr)); 692 seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
725
726 return 0; 693 return 0;
727} /* end afs_proc_cell_vlservers_show() */ 694}
728 695
729/*****************************************************************************/
730/* 696/*
731 * open "/proc/fs/afs/<cell>/servers" which provides a summary of active 697 * open "/proc/fs/afs/<cell>/servers" which provides a summary of active
732 * servers 698 * servers
@@ -747,11 +713,9 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
747 713
748 m = file->private_data; 714 m = file->private_data;
749 m->private = cell; 715 m->private = cell;
750
751 return 0; 716 return 0;
752} /* end afs_proc_cell_servers_open() */ 717}
753 718
754/*****************************************************************************/
755/* 719/*
756 * close the file and release the ref to the cell 720 * close the file and release the ref to the cell
757 */ 721 */
@@ -764,11 +728,9 @@ static int afs_proc_cell_servers_release(struct inode *inode,
764 ret = seq_release(inode, file); 728 ret = seq_release(inode, file);
765 729
766 afs_put_cell(cell); 730 afs_put_cell(cell);
767
768 return ret; 731 return ret;
769} /* end afs_proc_cell_servers_release() */ 732}
770 733
771/*****************************************************************************/
772/* 734/*
773 * set up the iterator to start reading from the cells list and return the 735 * set up the iterator to start reading from the cells list and return the
774 * first item 736 * first item
@@ -796,9 +758,8 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
796 break; 758 break;
797 759
798 return _p != &cell->sv_list ? _p : NULL; 760 return _p != &cell->sv_list ? _p : NULL;
799} /* end afs_proc_cell_servers_start() */ 761}
800 762
801/*****************************************************************************/
802/* 763/*
803 * move to next cell in cells list 764 * move to next cell in cells list
804 */ 765 */
@@ -816,9 +777,8 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
816 _p = v == (void *) 1 ? cell->sv_list.next : _p->next; 777 _p = v == (void *) 1 ? cell->sv_list.next : _p->next;
817 778
818 return _p != &cell->sv_list ? _p : NULL; 779 return _p != &cell->sv_list ? _p : NULL;
819} /* end afs_proc_cell_servers_next() */ 780}
820 781
821/*****************************************************************************/
822/* 782/*
823 * clean up after reading from the cells list 783 * clean up after reading from the cells list
824 */ 784 */
@@ -828,10 +788,8 @@ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
828 struct afs_cell *cell = p->private; 788 struct afs_cell *cell = p->private;
829 789
830 read_unlock(&cell->sv_lock); 790 read_unlock(&cell->sv_lock);
791}
831 792
832} /* end afs_proc_cell_servers_stop() */
833
834/*****************************************************************************/
835/* 793/*
836 * display a header line followed by a load of volume lines 794 * display a header line followed by a load of volume lines
837 */ 795 */
@@ -849,10 +807,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
849 /* display one cell per line on subsequent lines */ 807 /* display one cell per line on subsequent lines */
850 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr)); 808 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
851 seq_printf(m, "%3d %-15.15s %5d\n", 809 seq_printf(m, "%3d %-15.15s %5d\n",
852 atomic_read(&server->usage), 810 atomic_read(&server->usage), ipaddr, server->fs_state);
853 ipaddr,
854 server->fs_state
855 );
856 811
857 return 0; 812 return 0;
858} /* end afs_proc_cell_servers_show() */ 813}
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 44aff81dc6a7..44b0ce53e913 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -1,4 +1,4 @@
1/* server.c: AFS server record management 1/* AFS server record management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -41,7 +41,6 @@ static const struct afs_timer_ops afs_server_timer_ops = {
41 .timed_out = __afs_server_timeout, 41 .timed_out = __afs_server_timeout,
42}; 42};
43 43
44/*****************************************************************************/
45/* 44/*
46 * lookup a server record in a cell 45 * lookup a server record in a cell
47 * - TODO: search the cell's server list 46 * - TODO: search the cell's server list
@@ -106,7 +105,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
106 return 0; 105 return 0;
107 106
108 /* found a matching active server */ 107 /* found a matching active server */
109 use_active_server: 108use_active_server:
110 _debug("active server"); 109 _debug("active server");
111 afs_get_server(active); 110 afs_get_server(active);
112 write_unlock(&cell->sv_lock); 111 write_unlock(&cell->sv_lock);
@@ -119,7 +118,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
119 118
120 /* found a matching server in the graveyard, so resurrect it and 119 /* found a matching server in the graveyard, so resurrect it and
121 * dispose of the new record */ 120 * dispose of the new record */
122 resurrect_server: 121resurrect_server:
123 _debug("resurrecting server"); 122 _debug("resurrecting server");
124 123
125 list_move_tail(&zombie->link, &cell->sv_list); 124 list_move_tail(&zombie->link, &cell->sv_list);
@@ -133,10 +132,8 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
133 *_server = zombie; 132 *_server = zombie;
134 _leave(" = 0 (%p)", zombie); 133 _leave(" = 0 (%p)", zombie);
135 return 0; 134 return 0;
135}
136 136
137} /* end afs_server_lookup() */
138
139/*****************************************************************************/
140/* 137/*
141 * destroy a server record 138 * destroy a server record
142 * - removes from the cell list 139 * - removes from the cell list
@@ -175,9 +172,8 @@ void afs_put_server(struct afs_server *server)
175 write_unlock(&cell->sv_lock); 172 write_unlock(&cell->sv_lock);
176 173
177 _leave(" [killed]"); 174 _leave(" [killed]");
178} /* end afs_put_server() */ 175}
179 176
180/*****************************************************************************/
181/* 177/*
182 * timeout server record 178 * timeout server record
183 * - removes from the cell's graveyard if the usage count is zero 179 * - removes from the cell's graveyard if the usage count is zero
@@ -230,9 +226,8 @@ void afs_server_do_timeout(struct afs_server *server)
230 kfree(server); 226 kfree(server);
231 227
232 _leave(" [destroyed]"); 228 _leave(" [destroyed]");
233} /* end afs_server_do_timeout() */ 229}
234 230
235/*****************************************************************************/
236/* 231/*
237 * get a callslot on a connection to the fileserver on the specified server 232 * get a callslot on a connection to the fileserver on the specified server
238 */ 233 */
@@ -323,7 +318,7 @@ int afs_server_request_callslot(struct afs_server *server,
323 } 318 }
324 319
325 /* got a callslot, but no connection */ 320 /* got a callslot, but no connection */
326 obtained_slot: 321obtained_slot:
327 322
328 /* need to get hold of the RxRPC connection */ 323 /* need to get hold of the RxRPC connection */
329 down_write(&server->sem); 324 down_write(&server->sem);
@@ -337,8 +332,7 @@ int afs_server_request_callslot(struct afs_server *server,
337 /* reuse an existing connection */ 332 /* reuse an existing connection */
338 rxrpc_get_connection(server->fs_conn[nconn]); 333 rxrpc_get_connection(server->fs_conn[nconn]);
339 callslot->conn = server->fs_conn[nconn]; 334 callslot->conn = server->fs_conn[nconn];
340 } 335 } else {
341 else {
342 /* create a new connection */ 336 /* create a new connection */
343 ret = rxrpc_create_connection(afs_transport, 337 ret = rxrpc_create_connection(afs_transport,
344 htons(7000), 338 htons(7000),
@@ -360,23 +354,21 @@ int afs_server_request_callslot(struct afs_server *server,
360 return 0; 354 return 0;
361 355
362 /* handle an error occurring */ 356 /* handle an error occurring */
363 error_release_upw: 357error_release_upw:
364 up_write(&server->sem); 358 up_write(&server->sem);
365 359
366 error_release: 360error_release:
367 /* either release the callslot or pass it along to another deserving 361 /* either release the callslot or pass it along to another deserving
368 * task */ 362 * task */
369 spin_lock(&server->fs_lock); 363 spin_lock(&server->fs_lock);
370 364
371 if (nconn < 0) { 365 if (nconn < 0) {
372 /* no callslot allocated */ 366 /* no callslot allocated */
373 } 367 } else if (list_empty(&server->fs_callq)) {
374 else if (list_empty(&server->fs_callq)) {
375 /* no one waiting */ 368 /* no one waiting */
376 server->fs_conn_cnt[nconn]++; 369 server->fs_conn_cnt[nconn]++;
377 spin_unlock(&server->fs_lock); 370 spin_unlock(&server->fs_lock);
378 } 371 } else {
379 else {
380 /* someone's waiting - dequeue them and wake them up */ 372 /* someone's waiting - dequeue them and wake them up */
381 pcallslot = list_entry(server->fs_callq.next, 373 pcallslot = list_entry(server->fs_callq.next,
382 struct afs_server_callslot, link); 374 struct afs_server_callslot, link);
@@ -400,10 +392,8 @@ int afs_server_request_callslot(struct afs_server *server,
400 392
401 _leave(" = %d", ret); 393 _leave(" = %d", ret);
402 return ret; 394 return ret;
395}
403 396
404} /* end afs_server_request_callslot() */
405
406/*****************************************************************************/
407/* 397/*
408 * release a callslot back to the server 398 * release a callslot back to the server
409 * - transfers the RxRPC connection to the next pending callslot if possible 399 * - transfers the RxRPC connection to the next pending callslot if possible
@@ -426,8 +416,7 @@ void afs_server_release_callslot(struct afs_server *server,
426 /* no one waiting */ 416 /* no one waiting */
427 server->fs_conn_cnt[callslot->nconn]++; 417 server->fs_conn_cnt[callslot->nconn]++;
428 spin_unlock(&server->fs_lock); 418 spin_unlock(&server->fs_lock);
429 } 419 } else {
430 else {
431 /* someone's waiting - dequeue them and wake them up */ 420 /* someone's waiting - dequeue them and wake them up */
432 pcallslot = list_entry(server->fs_callq.next, 421 pcallslot = list_entry(server->fs_callq.next,
433 struct afs_server_callslot, link); 422 struct afs_server_callslot, link);
@@ -449,9 +438,8 @@ void afs_server_release_callslot(struct afs_server *server,
449 rxrpc_put_connection(callslot->conn); 438 rxrpc_put_connection(callslot->conn);
450 439
451 _leave(""); 440 _leave("");
452} /* end afs_server_release_callslot() */ 441}
453 442
454/*****************************************************************************/
455/* 443/*
456 * get a handle to a connection to the vlserver (volume location) on the 444 * get a handle to a connection to the vlserver (volume location) on the
457 * specified server 445 * specified server
@@ -473,8 +461,7 @@ int afs_server_get_vlconn(struct afs_server *server,
473 rxrpc_get_connection(server->vlserver); 461 rxrpc_get_connection(server->vlserver);
474 conn = server->vlserver; 462 conn = server->vlserver;
475 up_read(&server->sem); 463 up_read(&server->sem);
476 } 464 } else {
477 else {
478 /* create a new connection */ 465 /* create a new connection */
479 up_read(&server->sem); 466 up_read(&server->sem);
480 down_write(&server->sem); 467 down_write(&server->sem);
@@ -496,4 +483,4 @@ int afs_server_get_vlconn(struct afs_server *server,
496 *_conn = conn; 483 *_conn = conn;
497 _leave(" = %d", ret); 484 _leave(" = %d", ret);
498 return ret; 485 return ret;
499} /* end afs_server_get_vlconn() */ 486}
diff --git a/fs/afs/server.h b/fs/afs/server.h
index c3d24115578f..e1a006829b5d 100644
--- a/fs/afs/server.h
+++ b/fs/afs/server.h
@@ -1,4 +1,4 @@
1/* server.h: AFS server record 1/* AFS server record
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_SERVER_H 12#ifndef AFS_SERVER_H
13#define _LINUX_AFS_SERVER_H 13#define AFS_SERVER_H
14 14
15#include "types.h" 15#include "types.h"
16#include "kafstimod.h" 16#include "kafstimod.h"
@@ -19,12 +19,10 @@
19 19
20extern spinlock_t afs_server_peer_lock; 20extern spinlock_t afs_server_peer_lock;
21 21
22/*****************************************************************************/
23/* 22/*
24 * AFS server record 23 * AFS server record
25 */ 24 */
26struct afs_server 25struct afs_server {
27{
28 atomic_t usage; 26 atomic_t usage;
29 struct afs_cell *cell; /* cell in which server resides */ 27 struct afs_cell *cell; /* cell in which server resides */
30 struct list_head link; /* link in cell's server list */ 28 struct list_head link; /* link in cell's server list */
@@ -50,20 +48,19 @@ struct afs_server
50 spinlock_t cb_lock; /* access lock */ 48 spinlock_t cb_lock; /* access lock */
51}; 49};
52 50
53extern int afs_server_lookup(struct afs_cell *cell, 51extern int afs_server_lookup(struct afs_cell *, const struct in_addr *,
54 const struct in_addr *addr, 52 struct afs_server **);
55 struct afs_server **_server);
56 53
57#define afs_get_server(S) do { atomic_inc(&(S)->usage); } while(0) 54#define afs_get_server(S) do { atomic_inc(&(S)->usage); } while(0)
58 55
59extern void afs_put_server(struct afs_server *server); 56extern void afs_put_server(struct afs_server *);
60extern void afs_server_do_timeout(struct afs_server *server); 57extern void afs_server_do_timeout(struct afs_server *);
61 58
62extern int afs_server_find_by_peer(const struct rxrpc_peer *peer, 59extern int afs_server_find_by_peer(const struct rxrpc_peer *,
63 struct afs_server **_server); 60 struct afs_server **);
64 61
65extern int afs_server_get_vlconn(struct afs_server *server, 62extern int afs_server_get_vlconn(struct afs_server *,
66 struct rxrpc_connection **_conn); 63 struct rxrpc_connection **);
67 64
68static inline 65static inline
69struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer) 66struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer)
@@ -79,12 +76,10 @@ struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer)
79 return server; 76 return server;
80} 77}
81 78
82/*****************************************************************************/
83/* 79/*
84 * AFS server callslot grant record 80 * AFS server callslot grant record
85 */ 81 */
86struct afs_server_callslot 82struct afs_server_callslot {
87{
88 struct list_head link; /* link in server's list */ 83 struct list_head link; /* link in server's list */
89 struct task_struct *task; /* process waiting to make call */ 84 struct task_struct *task; /* process waiting to make call */
90 struct rxrpc_connection *conn; /* connection to use (or NULL on error) */ 85 struct rxrpc_connection *conn; /* connection to use (or NULL on error) */
@@ -93,10 +88,10 @@ struct afs_server_callslot
93 int errno; /* error number if nconn==-1 */ 88 int errno; /* error number if nconn==-1 */
94}; 89};
95 90
96extern int afs_server_request_callslot(struct afs_server *server, 91extern int afs_server_request_callslot(struct afs_server *,
97 struct afs_server_callslot *callslot); 92 struct afs_server_callslot *);
98 93
99extern void afs_server_release_callslot(struct afs_server *server, 94extern void afs_server_release_callslot(struct afs_server *,
100 struct afs_server_callslot *callslot); 95 struct afs_server_callslot *);
101 96
102#endif /* _LINUX_AFS_SERVER_H */ 97#endif /* AFS_SERVER_H */
diff --git a/fs/afs/super.c b/fs/afs/super.c
index eb7e32349da3..0470a5c0b8a1 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -1,4 +1,5 @@
1/* 1/* AFS superblock handling
2 *
2 * Copyright (c) 2002 Red Hat, Inc. All rights reserved. 3 * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
3 * 4 *
4 * This software may be freely redistributed under the terms of the 5 * This software may be freely redistributed under the terms of the
@@ -9,7 +10,7 @@
9 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 10 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10 * 11 *
11 * Authors: David Howells <dhowells@redhat.com> 12 * Authors: David Howells <dhowells@redhat.com>
12 * David Woodhouse <dwmw2@cambridge.redhat.com> 13 * David Woodhouse <dwmw2@redhat.com>
13 * 14 *
14 */ 15 */
15 16
@@ -68,7 +69,6 @@ static const struct super_operations afs_super_ops = {
68static struct kmem_cache *afs_inode_cachep; 69static struct kmem_cache *afs_inode_cachep;
69static atomic_t afs_count_active_inodes; 70static atomic_t afs_count_active_inodes;
70 71
71/*****************************************************************************/
72/* 72/*
73 * initialise the filesystem 73 * initialise the filesystem
74 */ 74 */
@@ -105,9 +105,8 @@ int __init afs_fs_init(void)
105 105
106 kleave(" = 0"); 106 kleave(" = 0");
107 return 0; 107 return 0;
108} /* end afs_fs_init() */ 108}
109 109
110/*****************************************************************************/
111/* 110/*
112 * clean up the filesystem 111 * clean up the filesystem
113 */ 112 */
@@ -122,10 +121,8 @@ void __exit afs_fs_exit(void)
122 } 121 }
123 122
124 kmem_cache_destroy(afs_inode_cachep); 123 kmem_cache_destroy(afs_inode_cachep);
124}
125 125
126} /* end afs_fs_exit() */
127
128/*****************************************************************************/
129/* 126/*
130 * check that an argument has a value 127 * check that an argument has a value
131 */ 128 */
@@ -136,9 +133,8 @@ static int want_arg(char **_value, const char *option)
136 return 0; 133 return 0;
137 } 134 }
138 return 1; 135 return 1;
139} /* end want_arg() */ 136}
140 137
141/*****************************************************************************/
142/* 138/*
143 * check that there's no subsequent value 139 * check that there's no subsequent value
144 */ 140 */
@@ -150,9 +146,8 @@ static int want_no_value(char *const *_value, const char *option)
150 return 0; 146 return 0;
151 } 147 }
152 return 1; 148 return 1;
153} /* end want_no_value() */ 149}
154 150
155/*****************************************************************************/
156/* 151/*
157 * parse the mount options 152 * parse the mount options
158 * - this function has been shamelessly adapted from the ext3 fs which 153 * - this function has been shamelessly adapted from the ext3 fs which
@@ -183,14 +178,12 @@ static int afs_super_parse_options(struct afs_mount_params *params,
183 return -EINVAL; 178 return -EINVAL;
184 params->rwpath = 1; 179 params->rwpath = 1;
185 continue; 180 continue;
186 } 181 } else if (strcmp(key, "vol") == 0) {
187 else if (strcmp(key, "vol") == 0) {
188 if (!want_arg(&value, "vol")) 182 if (!want_arg(&value, "vol"))
189 return -EINVAL; 183 return -EINVAL;
190 *devname = value; 184 *devname = value;
191 continue; 185 continue;
192 } 186 } else if (strcmp(key, "cell") == 0) {
193 else if (strcmp(key, "cell") == 0) {
194 if (!want_arg(&value, "cell")) 187 if (!want_arg(&value, "cell"))
195 return -EINVAL; 188 return -EINVAL;
196 afs_put_cell(params->default_cell); 189 afs_put_cell(params->default_cell);
@@ -209,12 +202,11 @@ static int afs_super_parse_options(struct afs_mount_params *params,
209 202
210 ret = 0; 203 ret = 0;
211 204
212 error: 205error:
213 _leave(" = %d", ret); 206 _leave(" = %d", ret);
214 return ret; 207 return ret;
215} /* end afs_super_parse_options() */ 208}
216 209
217/*****************************************************************************/
218/* 210/*
219 * check a superblock to see if it's the one we're looking for 211 * check a superblock to see if it's the one we're looking for
220 */ 212 */
@@ -224,9 +216,8 @@ static int afs_test_super(struct super_block *sb, void *data)
224 struct afs_super_info *as = sb->s_fs_info; 216 struct afs_super_info *as = sb->s_fs_info;
225 217
226 return as->volume == params->volume; 218 return as->volume == params->volume;
227} /* end afs_test_super() */ 219}
228 220
229/*****************************************************************************/
230/* 221/*
231 * fill in the superblock 222 * fill in the superblock
232 */ 223 */
@@ -276,7 +267,7 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
276 kleave(" = 0"); 267 kleave(" = 0");
277 return 0; 268 return 0;
278 269
279 error: 270error:
280 iput(inode); 271 iput(inode);
281 afs_put_volume(as->volume); 272 afs_put_volume(as->volume);
282 kfree(as); 273 kfree(as);
@@ -285,9 +276,8 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
285 276
286 kleave(" = %d", ret); 277 kleave(" = %d", ret);
287 return ret; 278 return ret;
288} /* end afs_fill_super() */ 279}
289 280
290/*****************************************************************************/
291/* 281/*
292 * get an AFS superblock 282 * get an AFS superblock
293 * - TODO: don't use get_sb_nodev(), but rather call sget() directly 283 * - TODO: don't use get_sb_nodev(), but rather call sget() directly
@@ -354,15 +344,14 @@ static int afs_get_sb(struct file_system_type *fs_type,
354 _leave(" = 0 [%p]", 0, sb); 344 _leave(" = 0 [%p]", 0, sb);
355 return 0; 345 return 0;
356 346
357 error: 347error:
358 afs_put_volume(params.volume); 348 afs_put_volume(params.volume);
359 afs_put_cell(params.default_cell); 349 afs_put_cell(params.default_cell);
360 afscm_stop(); 350 afscm_stop();
361 _leave(" = %d", ret); 351 _leave(" = %d", ret);
362 return ret; 352 return ret;
363} /* end afs_get_sb() */ 353}
364 354
365/*****************************************************************************/
366/* 355/*
367 * finish the unmounting process on the superblock 356 * finish the unmounting process on the superblock
368 */ 357 */
@@ -376,16 +365,15 @@ static void afs_put_super(struct super_block *sb)
376 afscm_stop(); 365 afscm_stop();
377 366
378 _leave(""); 367 _leave("");
379} /* end afs_put_super() */ 368}
380 369
381/*****************************************************************************/
382/* 370/*
383 * initialise an inode cache slab element prior to any use 371 * initialise an inode cache slab element prior to any use
384 */ 372 */
385static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, 373static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
386 unsigned long flags) 374 unsigned long flags)
387{ 375{
388 struct afs_vnode *vnode = (struct afs_vnode *) _vnode; 376 struct afs_vnode *vnode = _vnode;
389 377
390 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 378 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
391 SLAB_CTOR_CONSTRUCTOR) { 379 SLAB_CTOR_CONSTRUCTOR) {
@@ -398,10 +386,8 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
398 afs_timer_init(&vnode->cb_timeout, 386 afs_timer_init(&vnode->cb_timeout,
399 &afs_vnode_cb_timed_out_ops); 387 &afs_vnode_cb_timed_out_ops);
400 } 388 }
389}
401 390
402} /* end afs_i_init_once() */
403
404/*****************************************************************************/
405/* 391/*
406 * allocate an AFS inode struct from our slab cache 392 * allocate an AFS inode struct from our slab cache
407 */ 393 */
@@ -409,8 +395,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
409{ 395{
410 struct afs_vnode *vnode; 396 struct afs_vnode *vnode;
411 397
412 vnode = (struct afs_vnode *) 398 vnode = kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
413 kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
414 if (!vnode) 399 if (!vnode)
415 return NULL; 400 return NULL;
416 401
@@ -424,9 +409,8 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
424 vnode->flags = 0; 409 vnode->flags = 0;
425 410
426 return &vnode->vfs_inode; 411 return &vnode->vfs_inode;
427} /* end afs_alloc_inode() */ 412}
428 413
429/*****************************************************************************/
430/* 414/*
431 * destroy an AFS inode struct 415 * destroy an AFS inode struct
432 */ 416 */
@@ -435,7 +419,5 @@ static void afs_destroy_inode(struct inode *inode)
435 _enter("{%lu}", inode->i_ino); 419 _enter("{%lu}", inode->i_ino);
436 420
437 kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode)); 421 kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode));
438
439 atomic_dec(&afs_count_active_inodes); 422 atomic_dec(&afs_count_active_inodes);
440 423}
441} /* end afs_destroy_inode() */
diff --git a/fs/afs/super.h b/fs/afs/super.h
index 32de8cc6fae8..c95b48edfc7e 100644
--- a/fs/afs/super.h
+++ b/fs/afs/super.h
@@ -1,4 +1,4 @@
1/* super.h: AFS filesystem internal private data 1/* AFS filesystem internal private data
2 * 2 *
3 * Copyright (c) 2002 Red Hat, Inc. All rights reserved. 3 * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
4 * 4 *
@@ -14,21 +14,17 @@
14 * 14 *
15 */ 15 */
16 16
17#ifndef _LINUX_AFS_SUPER_H 17#ifndef AFS_SUPER_H
18#define _LINUX_AFS_SUPER_H 18#define AFS_SUPER_H
19 19
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include "server.h" 21#include "server.h"
22 22
23#ifdef __KERNEL__
24
25/*****************************************************************************/
26/* 23/*
27 * AFS superblock private data 24 * AFS superblock private data
28 * - there's one superblock per volume 25 * - there's one superblock per volume
29 */ 26 */
30struct afs_super_info 27struct afs_super_info {
31{
32 struct afs_volume *volume; /* volume record */ 28 struct afs_volume *volume; /* volume record */
33 char rwparent; /* T if parent is R/W AFS volume */ 29 char rwparent; /* T if parent is R/W AFS volume */
34}; 30};
@@ -40,6 +36,4 @@ static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
40 36
41extern struct file_system_type afs_fs_type; 37extern struct file_system_type afs_fs_type;
42 38
43#endif /* __KERNEL__ */ 39#endif /* AFS_SUPER_H */
44
45#endif /* _LINUX_AFS_SUPER_H */
diff --git a/fs/afs/transport.h b/fs/afs/transport.h
index 7013ae6ccc8c..f56be4b7b1d0 100644
--- a/fs/afs/transport.h
+++ b/fs/afs/transport.h
@@ -1,4 +1,4 @@
1/* transport.h: AFS transport management 1/* AFS transport management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_TRANSPORT_H 12#ifndef AFS_TRANSPORT_H
13#define _LINUX_AFS_TRANSPORT_H 13#define AFS_TRANSPORT_H
14 14
15#include "types.h" 15#include "types.h"
16#include <rxrpc/transport.h> 16#include <rxrpc/transport.h>
@@ -18,4 +18,4 @@
18/* the cache manager transport endpoint */ 18/* the cache manager transport endpoint */
19extern struct rxrpc_transport *afs_transport; 19extern struct rxrpc_transport *afs_transport;
20 20
21#endif /* _LINUX_AFS_TRANSPORT_H */ 21#endif /* AFS_TRANSPORT_H */
diff --git a/fs/afs/types.h b/fs/afs/types.h
index b1a2367c7587..db2b5dc9ff4b 100644
--- a/fs/afs/types.h
+++ b/fs/afs/types.h
@@ -1,4 +1,4 @@
1/* types.h: AFS types 1/* AFS types
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,12 +9,10 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_TYPES_H 12#ifndef AFS_TYPES_H
13#define _LINUX_AFS_TYPES_H 13#define AFS_TYPES_H
14 14
15#ifdef __KERNEL__
16#include <rxrpc/types.h> 15#include <rxrpc/types.h>
17#endif /* __KERNEL__ */
18 16
19typedef unsigned afs_volid_t; 17typedef unsigned afs_volid_t;
20typedef unsigned afs_vnodeid_t; 18typedef unsigned afs_vnodeid_t;
@@ -33,23 +31,18 @@ typedef enum {
33 AFS_FTYPE_SYMLINK = 3, 31 AFS_FTYPE_SYMLINK = 3,
34} afs_file_type_t; 32} afs_file_type_t;
35 33
36#ifdef __KERNEL__
37
38struct afs_cell; 34struct afs_cell;
39struct afs_vnode; 35struct afs_vnode;
40 36
41/*****************************************************************************/
42/* 37/*
43 * AFS file identifier 38 * AFS file identifier
44 */ 39 */
45struct afs_fid 40struct afs_fid {
46{
47 afs_volid_t vid; /* volume ID */ 41 afs_volid_t vid; /* volume ID */
48 afs_vnodeid_t vnode; /* file index within volume */ 42 afs_vnodeid_t vnode; /* file index within volume */
49 unsigned unique; /* unique ID number (file index version) */ 43 unsigned unique; /* unique ID number (file index version) */
50}; 44};
51 45
52/*****************************************************************************/
53/* 46/*
54 * AFS callback notification 47 * AFS callback notification
55 */ 48 */
@@ -60,8 +53,7 @@ typedef enum {
60 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */ 53 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
61} afs_callback_type_t; 54} afs_callback_type_t;
62 55
63struct afs_callback 56struct afs_callback {
64{
65 struct afs_server *server; /* server that made the promise */ 57 struct afs_server *server; /* server that made the promise */
66 struct afs_fid fid; /* file identifier */ 58 struct afs_fid fid; /* file identifier */
67 unsigned version; /* callback version */ 59 unsigned version; /* callback version */
@@ -71,12 +63,10 @@ struct afs_callback
71 63
72#define AFSCBMAX 50 64#define AFSCBMAX 50
73 65
74/*****************************************************************************/
75/* 66/*
76 * AFS volume information 67 * AFS volume information
77 */ 68 */
78struct afs_volume_info 69struct afs_volume_info {
79{
80 afs_volid_t vid; /* volume ID */ 70 afs_volid_t vid; /* volume ID */
81 afs_voltype_t type; /* type of this volume */ 71 afs_voltype_t type; /* type of this volume */
82 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */ 72 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
@@ -88,12 +78,10 @@ struct afs_volume_info
88 } servers[8]; 78 } servers[8];
89}; 79};
90 80
91/*****************************************************************************/
92/* 81/*
93 * AFS file status information 82 * AFS file status information
94 */ 83 */
95struct afs_file_status 84struct afs_file_status {
96{
97 unsigned if_version; /* interface version */ 85 unsigned if_version; /* interface version */
98#define AFS_FSTATUS_VERSION 1 86#define AFS_FSTATUS_VERSION 1
99 87
@@ -111,15 +99,11 @@ struct afs_file_status
111 time_t mtime_server; /* last time server changed data */ 99 time_t mtime_server; /* last time server changed data */
112}; 100};
113 101
114/*****************************************************************************/
115/* 102/*
116 * AFS volume synchronisation information 103 * AFS volume synchronisation information
117 */ 104 */
118struct afs_volsync 105struct afs_volsync {
119{
120 time_t creation; /* volume creation time */ 106 time_t creation; /* volume creation time */
121}; 107};
122 108
123#endif /* __KERNEL__ */ 109#endif /* AFS_TYPES_H */
124
125#endif /* _LINUX_AFS_TYPES_H */
diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c
index 7b0e3192ee39..dac9faa70ff4 100644
--- a/fs/afs/vlclient.c
+++ b/fs/afs/vlclient.c
@@ -1,4 +1,4 @@
1/* vlclient.c: AFS Volume Location Service client 1/* AFS Volume Location Service client
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -30,7 +30,6 @@
30static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call); 30static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call);
31static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call); 31static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call);
32 32
33/*****************************************************************************/
34/* 33/*
35 * map afs VL abort codes to/from Linux error codes 34 * map afs VL abort codes to/from Linux error codes
36 * - called with call->lock held 35 * - called with call->lock held
@@ -87,10 +86,9 @@ static void afs_rxvl_aemap(struct rxrpc_call *call)
87 default: 86 default:
88 return; 87 return;
89 } 88 }
90} /* end afs_rxvl_aemap() */ 89}
91 90
92#if 0 91#if 0
93/*****************************************************************************/
94/* 92/*
95 * probe a volume location server to see if it is still alive -- unused 93 * probe a volume location server to see if it is still alive -- unused
96 */ 94 */
@@ -159,24 +157,22 @@ static int afs_rxvl_probe(struct afs_server *server, int alloc_flags)
159 BUG(); 157 BUG();
160 } 158 }
161 159
162 abort: 160abort:
163 set_current_state(TASK_UNINTERRUPTIBLE); 161 set_current_state(TASK_UNINTERRUPTIBLE);
164 rxrpc_call_abort(call, ret); 162 rxrpc_call_abort(call, ret);
165 schedule(); 163 schedule();
166 164
167 out_unwait: 165out_unwait:
168 set_current_state(TASK_RUNNING); 166 set_current_state(TASK_RUNNING);
169 remove_wait_queue(&call->waitq, &myself); 167 remove_wait_queue(&call->waitq, &myself);
170 rxrpc_put_call(call); 168 rxrpc_put_call(call);
171 out_put_conn: 169out_put_conn:
172 rxrpc_put_connection(conn); 170 rxrpc_put_connection(conn);
173 out: 171out:
174 return ret; 172 return ret;
175 173}
176} /* end afs_rxvl_probe() */
177#endif 174#endif
178 175
179/*****************************************************************************/
180/* 176/*
181 * look up a volume location database entry by name 177 * look up a volume location database entry by name
182 */ 178 */
@@ -294,24 +290,23 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server,
294 entry->rtime = get_seconds(); 290 entry->rtime = get_seconds();
295 ret = 0; 291 ret = 0;
296 292
297 out_unwait: 293out_unwait:
298 set_current_state(TASK_RUNNING); 294 set_current_state(TASK_RUNNING);
299 remove_wait_queue(&call->waitq, &myself); 295 remove_wait_queue(&call->waitq, &myself);
300 rxrpc_put_call(call); 296 rxrpc_put_call(call);
301 out_put_conn: 297out_put_conn:
302 rxrpc_put_connection(conn); 298 rxrpc_put_connection(conn);
303 out: 299out:
304 _leave(" = %d", ret); 300 _leave(" = %d", ret);
305 return ret; 301 return ret;
306 302
307 abort: 303abort:
308 set_current_state(TASK_UNINTERRUPTIBLE); 304 set_current_state(TASK_UNINTERRUPTIBLE);
309 rxrpc_call_abort(call, ret); 305 rxrpc_call_abort(call, ret);
310 schedule(); 306 schedule();
311 goto out_unwait; 307 goto out_unwait;
312} /* end afs_rxvl_get_entry_by_name() */ 308}
313 309
314/*****************************************************************************/
315/* 310/*
316 * look up a volume location database entry by ID 311 * look up a volume location database entry by ID
317 */ 312 */
@@ -434,24 +429,23 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server,
434 entry->rtime = get_seconds(); 429 entry->rtime = get_seconds();
435 ret = 0; 430 ret = 0;
436 431
437 out_unwait: 432out_unwait:
438 set_current_state(TASK_RUNNING); 433 set_current_state(TASK_RUNNING);
439 remove_wait_queue(&call->waitq, &myself); 434 remove_wait_queue(&call->waitq, &myself);
440 rxrpc_put_call(call); 435 rxrpc_put_call(call);
441 out_put_conn: 436out_put_conn:
442 rxrpc_put_connection(conn); 437 rxrpc_put_connection(conn);
443 out: 438out:
444 _leave(" = %d", ret); 439 _leave(" = %d", ret);
445 return ret; 440 return ret;
446 441
447 abort: 442abort:
448 set_current_state(TASK_UNINTERRUPTIBLE); 443 set_current_state(TASK_UNINTERRUPTIBLE);
449 rxrpc_call_abort(call, ret); 444 rxrpc_call_abort(call, ret);
450 schedule(); 445 schedule();
451 goto out_unwait; 446 goto out_unwait;
452} /* end afs_rxvl_get_entry_by_id() */ 447}
453 448
454/*****************************************************************************/
455/* 449/*
456 * look up a volume location database entry by ID asynchronously 450 * look up a volume location database entry by ID asynchronously
457 */ 451 */
@@ -533,14 +527,12 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
533 break; 527 break;
534 } 528 }
535 529
536 out: 530out:
537 rxrpc_put_call(call); 531 rxrpc_put_call(call);
538 _leave(" = %d", ret); 532 _leave(" = %d", ret);
539 return ret; 533 return ret;
534}
540 535
541} /* end afs_rxvl_get_entry_by_id_async() */
542
543/*****************************************************************************/
544/* 536/*
545 * attend to the asynchronous get VLDB entry by ID 537 * attend to the asynchronous get VLDB entry by ID
546 */ 538 */
@@ -630,14 +622,13 @@ int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op,
630 _leave(" = -EAGAIN"); 622 _leave(" = -EAGAIN");
631 return -EAGAIN; 623 return -EAGAIN;
632 624
633 done: 625done:
634 rxrpc_put_call(op->call); 626 rxrpc_put_call(op->call);
635 op->call = NULL; 627 op->call = NULL;
636 _leave(" = %d", ret); 628 _leave(" = %d", ret);
637 return ret; 629 return ret;
638} /* end afs_rxvl_get_entry_by_id_async2() */ 630}
639 631
640/*****************************************************************************/
641/* 632/*
642 * handle attention events on an async get-entry-by-ID op 633 * handle attention events on an async get-entry-by-ID op
643 * - called from krxiod 634 * - called from krxiod
@@ -674,10 +665,8 @@ static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call)
674 } 665 }
675 666
676 _leave(""); 667 _leave("");
668}
677 669
678} /* end afs_rxvl_get_entry_by_id_attn() */
679
680/*****************************************************************************/
681/* 670/*
682 * handle error events on an async get-entry-by-ID op 671 * handle error events on an async get-entry-by-ID op
683 * - called from krxiod 672 * - called from krxiod
@@ -691,5 +680,4 @@ static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call)
691 afs_kafsasyncd_attend_op(op); 680 afs_kafsasyncd_attend_op(op);
692 681
693 _leave(""); 682 _leave("");
694 683}
695} /* end afs_rxvl_get_entry_by_id_error() */
diff --git a/fs/afs/vlclient.h b/fs/afs/vlclient.h
index e3d601179c46..11dc10fe3009 100644
--- a/fs/afs/vlclient.h
+++ b/fs/afs/vlclient.h
@@ -1,4 +1,4 @@
1/* vlclient.h: Volume Location Service client interface 1/* Volume Location Service client interface
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_VLCLIENT_H 12#ifndef AFS_VLCLIENT_H
13#define _LINUX_AFS_VLCLIENT_H 13#define AFS_VLCLIENT_H
14 14
15#include "types.h" 15#include "types.h"
16 16
@@ -68,26 +68,18 @@ struct afs_vldbentry {
68#define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */ 68#define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */
69#define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */ 69#define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */
70 } servers[8]; 70 } servers[8];
71
72}; 71};
73 72
74/* look up a volume location database entry by name */ 73extern int afs_rxvl_get_entry_by_name(struct afs_server *, const char *,
75extern int afs_rxvl_get_entry_by_name(struct afs_server *server, 74 unsigned, struct afs_cache_vlocation *);
76 const char *volname, 75extern int afs_rxvl_get_entry_by_id(struct afs_server *, afs_volid_t,
77 unsigned volnamesz, 76 afs_voltype_t,
78 struct afs_cache_vlocation *entry); 77 struct afs_cache_vlocation *);
79
80/* look up a volume location database entry by ID */
81extern int afs_rxvl_get_entry_by_id(struct afs_server *server,
82 afs_volid_t volid,
83 afs_voltype_t voltype,
84 struct afs_cache_vlocation *entry);
85 78
86extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op, 79extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *,
87 afs_volid_t volid, 80 afs_volid_t, afs_voltype_t);
88 afs_voltype_t voltype);
89 81
90extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op, 82extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *,
91 struct afs_cache_vlocation *entry); 83 struct afs_cache_vlocation *);
92 84
93#endif /* _LINUX_AFS_VLCLIENT_H */ 85#endif /* AFS_VLCLIENT_H */
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index 782ee7c600ca..e48728c92175 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -1,4 +1,4 @@
1/* vlocation.c: volume location management 1/* volume location management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -73,7 +73,6 @@ struct cachefs_index_def afs_vlocation_cache_index_def = {
73}; 73};
74#endif 74#endif
75 75
76/*****************************************************************************/
77/* 76/*
78 * iterate through the VL servers in a cell until one of them admits knowing 77 * iterate through the VL servers in a cell until one of them admits knowing
79 * about the volume in question 78 * about the volume in question
@@ -146,13 +145,11 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vlocation,
146 cell->vl_curr_svix %= cell->vl_naddrs; 145 cell->vl_curr_svix %= cell->vl_naddrs;
147 } 146 }
148 147
149 out: 148out:
150 _leave(" = %d", ret); 149 _leave(" = %d", ret);
151 return ret; 150 return ret;
151}
152 152
153} /* end afs_vlocation_access_vl_by_name() */
154
155/*****************************************************************************/
156/* 153/*
157 * iterate through the VL servers in a cell until one of them admits knowing 154 * iterate through the VL servers in a cell until one of them admits knowing
158 * about the volume in question 155 * about the volume in question
@@ -225,13 +222,11 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vlocation,
225 cell->vl_curr_svix %= cell->vl_naddrs; 222 cell->vl_curr_svix %= cell->vl_naddrs;
226 } 223 }
227 224
228 out: 225out:
229 _leave(" = %d", ret); 226 _leave(" = %d", ret);
230 return ret; 227 return ret;
228}
231 229
232} /* end afs_vlocation_access_vl_by_id() */
233
234/*****************************************************************************/
235/* 230/*
236 * lookup volume location 231 * lookup volume location
237 * - caller must have cell->vol_sem write-locked 232 * - caller must have cell->vol_sem write-locked
@@ -321,7 +316,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
321 316
322 goto found_on_vlserver; 317 goto found_on_vlserver;
323 318
324 found_in_graveyard: 319found_in_graveyard:
325 /* found in the graveyard - resurrect */ 320 /* found in the graveyard - resurrect */
326 _debug("found in graveyard"); 321 _debug("found in graveyard");
327 atomic_inc(&vlocation->usage); 322 atomic_inc(&vlocation->usage);
@@ -331,16 +326,16 @@ int afs_vlocation_lookup(struct afs_cell *cell,
331 afs_kafstimod_del_timer(&vlocation->timeout); 326 afs_kafstimod_del_timer(&vlocation->timeout);
332 goto active; 327 goto active;
333 328
334 found_in_memory: 329found_in_memory:
335 /* found in memory - check to see if it's active */ 330 /* found in memory - check to see if it's active */
336 _debug("found in memory"); 331 _debug("found in memory");
337 atomic_inc(&vlocation->usage); 332 atomic_inc(&vlocation->usage);
338 333
339 active: 334active:
340 active = 1; 335 active = 1;
341 336
342#ifdef AFS_CACHING_SUPPORT 337#ifdef AFS_CACHING_SUPPORT
343 found_in_cache: 338found_in_cache:
344#endif 339#endif
345 /* try to look up a cached volume in the cell VL databases by ID */ 340 /* try to look up a cached volume in the cell VL databases by ID */
346 _debug("found in cache"); 341 _debug("found in cache");
@@ -364,16 +359,13 @@ int afs_vlocation_lookup(struct afs_cell *cell,
364 if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) { 359 if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
365 vid = vlocation->vldb.vid[0]; 360 vid = vlocation->vldb.vid[0];
366 voltype = AFSVL_RWVOL; 361 voltype = AFSVL_RWVOL;
367 } 362 } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
368 else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
369 vid = vlocation->vldb.vid[1]; 363 vid = vlocation->vldb.vid[1];
370 voltype = AFSVL_ROVOL; 364 voltype = AFSVL_ROVOL;
371 } 365 } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
372 else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
373 vid = vlocation->vldb.vid[2]; 366 vid = vlocation->vldb.vid[2];
374 voltype = AFSVL_BACKVOL; 367 voltype = AFSVL_BACKVOL;
375 } 368 } else {
376 else {
377 BUG(); 369 BUG();
378 vid = 0; 370 vid = 0;
379 voltype = 0; 371 voltype = 0;
@@ -400,7 +392,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
400 goto error; 392 goto error;
401 } 393 }
402 394
403 found_on_vlserver: 395found_on_vlserver:
404 _debug("Done VL Lookup: %*.*s %02x { %08x(%x) %08x(%x) %08x(%x) }", 396 _debug("Done VL Lookup: %*.*s %02x { %08x(%x) %08x(%x) %08x(%x) }",
405 namesz, namesz, name, 397 namesz, namesz, name,
406 vldb.vidmask, 398 vldb.vidmask,
@@ -430,12 +422,11 @@ int afs_vlocation_lookup(struct afs_cell *cell,
430 _leave(" = 0 (%p)",vlocation); 422 _leave(" = 0 (%p)",vlocation);
431 return 0; 423 return 0;
432 424
433 error: 425error:
434 if (vlocation) { 426 if (vlocation) {
435 if (active) { 427 if (active) {
436 __afs_put_vlocation(vlocation); 428 __afs_put_vlocation(vlocation);
437 } 429 } else {
438 else {
439 list_del(&vlocation->link); 430 list_del(&vlocation->link);
440#ifdef AFS_CACHING_SUPPORT 431#ifdef AFS_CACHING_SUPPORT
441 cachefs_relinquish_cookie(vlocation->cache, 0); 432 cachefs_relinquish_cookie(vlocation->cache, 0);
@@ -447,9 +438,8 @@ int afs_vlocation_lookup(struct afs_cell *cell,
447 438
448 _leave(" = %d", ret); 439 _leave(" = %d", ret);
449 return ret; 440 return ret;
450} /* end afs_vlocation_lookup() */ 441}
451 442
452/*****************************************************************************/
453/* 443/*
454 * finish using a volume location record 444 * finish using a volume location record
455 * - caller must have cell->vol_sem write-locked 445 * - caller must have cell->vol_sem write-locked
@@ -489,9 +479,8 @@ static void __afs_put_vlocation(struct afs_vlocation *vlocation)
489 spin_unlock(&cell->vl_gylock); 479 spin_unlock(&cell->vl_gylock);
490 480
491 _leave(" [killed]"); 481 _leave(" [killed]");
492} /* end __afs_put_vlocation() */ 482}
493 483
494/*****************************************************************************/
495/* 484/*
496 * finish using a volume location record 485 * finish using a volume location record
497 */ 486 */
@@ -504,9 +493,8 @@ void afs_put_vlocation(struct afs_vlocation *vlocation)
504 __afs_put_vlocation(vlocation); 493 __afs_put_vlocation(vlocation);
505 up_write(&cell->vl_sem); 494 up_write(&cell->vl_sem);
506 } 495 }
507} /* end afs_put_vlocation() */ 496}
508 497
509/*****************************************************************************/
510/* 498/*
511 * timeout vlocation record 499 * timeout vlocation record
512 * - removes from the cell's graveyard if the usage count is zero 500 * - removes from the cell's graveyard if the usage count is zero
@@ -543,9 +531,8 @@ void afs_vlocation_do_timeout(struct afs_vlocation *vlocation)
543 kfree(vlocation); 531 kfree(vlocation);
544 532
545 _leave(" [destroyed]"); 533 _leave(" [destroyed]");
546} /* end afs_vlocation_do_timeout() */ 534}
547 535
548/*****************************************************************************/
549/* 536/*
550 * send an update operation to the currently selected server 537 * send an update operation to the currently selected server
551 */ 538 */
@@ -564,16 +551,13 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation)
564 if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) { 551 if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
565 vid = vlocation->vldb.vid[0]; 552 vid = vlocation->vldb.vid[0];
566 voltype = AFSVL_RWVOL; 553 voltype = AFSVL_RWVOL;
567 } 554 } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
568 else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
569 vid = vlocation->vldb.vid[1]; 555 vid = vlocation->vldb.vid[1];
570 voltype = AFSVL_ROVOL; 556 voltype = AFSVL_ROVOL;
571 } 557 } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
572 else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
573 vid = vlocation->vldb.vid[2]; 558 vid = vlocation->vldb.vid[2];
574 voltype = AFSVL_BACKVOL; 559 voltype = AFSVL_BACKVOL;
575 } 560 } else {
576 else {
577 BUG(); 561 BUG();
578 vid = 0; 562 vid = 0;
579 voltype = 0; 563 voltype = 0;
@@ -604,9 +588,8 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation)
604 588
605 _leave(" = %d", ret); 589 _leave(" = %d", ret);
606 return ret; 590 return ret;
607} /* end afs_vlocation_update_begin() */ 591}
608 592
609/*****************************************************************************/
610/* 593/*
611 * abandon updating a VL record 594 * abandon updating a VL record
612 * - does not restart the update timer 595 * - does not restart the update timer
@@ -634,9 +617,8 @@ static void afs_vlocation_update_abandon(struct afs_vlocation *vlocation,
634 spin_unlock(&afs_vlocation_update_lock); 617 spin_unlock(&afs_vlocation_update_lock);
635 618
636 _leave(""); 619 _leave("");
637} /* end afs_vlocation_update_abandon() */ 620}
638 621
639/*****************************************************************************/
640/* 622/*
641 * handle periodic update timeouts and busy retry timeouts 623 * handle periodic update timeouts and busy retry timeouts
642 * - called from kafstimod 624 * - called from kafstimod
@@ -663,8 +645,7 @@ static void afs_vlocation_update_timer(struct afs_timer *timer)
663 if (afs_vlocation_update) { 645 if (afs_vlocation_update) {
664 list_add(&vlocation->upd_op.link, 646 list_add(&vlocation->upd_op.link,
665 &afs_vlocation_update_pendq); 647 &afs_vlocation_update_pendq);
666 } 648 } else {
667 else {
668 afs_get_vlocation(vlocation); 649 afs_get_vlocation(vlocation);
669 afs_vlocation_update = vlocation; 650 afs_vlocation_update = vlocation;
670 vlocation->upd_state = AFS_VLUPD_INPROGRESS; 651 vlocation->upd_state = AFS_VLUPD_INPROGRESS;
@@ -706,16 +687,13 @@ static void afs_vlocation_update_timer(struct afs_timer *timer)
706 _leave(""); 687 _leave("");
707 return; 688 return;
708 689
709 out_unlock2: 690out_unlock2:
710 spin_unlock(&afs_vlocation_update_lock); 691 spin_unlock(&afs_vlocation_update_lock);
711 out_unlock1: 692out_unlock1:
712 spin_unlock(&vlocation->cell->vl_gylock); 693 spin_unlock(&vlocation->cell->vl_gylock);
713 _leave(""); 694 _leave("");
714 return; 695}
715
716} /* end afs_vlocation_update_timer() */
717 696
718/*****************************************************************************/
719/* 697/*
720 * attend to an update operation upon which an event happened 698 * attend to an update operation upon which an event happened
721 * - called in kafsasyncd context 699 * - called in kafsasyncd context
@@ -818,7 +796,7 @@ static void afs_vlocation_update_attend(struct afs_async_op *op)
818 } 796 }
819 797
820 /* try contacting the next server */ 798 /* try contacting the next server */
821 try_next: 799try_next:
822 vlocation->upd_busy_cnt = 0; 800 vlocation->upd_busy_cnt = 0;
823 801
824 /* discard the server record */ 802 /* discard the server record */
@@ -856,15 +834,13 @@ static void afs_vlocation_update_attend(struct afs_async_op *op)
856 } 834 }
857 835
858 /* abandon the update */ 836 /* abandon the update */
859 abandon: 837abandon:
860 afs_vlocation_update_abandon(vlocation, AFS_VLUPD_SLEEP, ret); 838 afs_vlocation_update_abandon(vlocation, AFS_VLUPD_SLEEP, ret);
861 afs_kafstimod_add_timer(&vlocation->upd_timer, HZ * 10); 839 afs_kafstimod_add_timer(&vlocation->upd_timer, HZ * 10);
862 afs_put_vlocation(vlocation); 840 afs_put_vlocation(vlocation);
863 _leave(" [abandoned]"); 841 _leave(" [abandoned]");
842}
864 843
865} /* end afs_vlocation_update_attend() */
866
867/*****************************************************************************/
868/* 844/*
869 * deal with an update operation being discarded 845 * deal with an update operation being discarded
870 * - called in kafsasyncd context when it's dying due to rmmod 846 * - called in kafsasyncd context when it's dying due to rmmod
@@ -883,9 +859,8 @@ static void afs_vlocation_update_discard(struct afs_async_op *op)
883 afs_put_vlocation(vlocation); 859 afs_put_vlocation(vlocation);
884 860
885 _leave(""); 861 _leave("");
886} /* end afs_vlocation_update_discard() */ 862}
887 863
888/*****************************************************************************/
889/* 864/*
890 * match a VLDB record stored in the cache 865 * match a VLDB record stored in the cache
891 * - may also load target from entry 866 * - may also load target from entry
@@ -908,9 +883,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
908 vlocation->valid = 1; 883 vlocation->valid = 1;
909 _leave(" = SUCCESS [c->m]"); 884 _leave(" = SUCCESS [c->m]");
910 return CACHEFS_MATCH_SUCCESS; 885 return CACHEFS_MATCH_SUCCESS;
911 } 886 } else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
912 /* need to update cache if cached info differs */
913 else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
914 /* delete if VIDs for this name differ */ 887 /* delete if VIDs for this name differ */
915 if (memcmp(&vlocation->vldb.vid, 888 if (memcmp(&vlocation->vldb.vid,
916 &vldb->vid, 889 &vldb->vid,
@@ -921,8 +894,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
921 894
922 _leave(" = UPDATE"); 895 _leave(" = UPDATE");
923 return CACHEFS_MATCH_SUCCESS_UPDATE; 896 return CACHEFS_MATCH_SUCCESS_UPDATE;
924 } 897 } else {
925 else {
926 _leave(" = SUCCESS"); 898 _leave(" = SUCCESS");
927 return CACHEFS_MATCH_SUCCESS; 899 return CACHEFS_MATCH_SUCCESS;
928 } 900 }
@@ -930,10 +902,9 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
930 902
931 _leave(" = FAILED"); 903 _leave(" = FAILED");
932 return CACHEFS_MATCH_FAILED; 904 return CACHEFS_MATCH_FAILED;
933} /* end afs_vlocation_cache_match() */ 905}
934#endif 906#endif
935 907
936/*****************************************************************************/
937/* 908/*
938 * update a VLDB record stored in the cache 909 * update a VLDB record stored in the cache
939 */ 910 */
@@ -946,6 +917,5 @@ static void afs_vlocation_cache_update(void *source, void *entry)
946 _enter(""); 917 _enter("");
947 918
948 *vldb = vlocation->vldb; 919 *vldb = vlocation->vldb;
949 920}
950} /* end afs_vlocation_cache_update() */
951#endif 921#endif
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index cf62da5d7825..4ab1ed710286 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -1,4 +1,4 @@
1/* vnode.c: AFS vnode management 1/* AFS vnode management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -43,7 +43,6 @@ struct cachefs_index_def afs_vnode_cache_index_def = {
43}; 43};
44#endif 44#endif
45 45
46/*****************************************************************************/
47/* 46/*
48 * handle a callback timing out 47 * handle a callback timing out
49 * TODO: retain a ref to vnode struct for an outstanding callback timeout 48 * TODO: retain a ref to vnode struct for an outstanding callback timeout
@@ -78,9 +77,8 @@ static void afs_vnode_cb_timed_out(struct afs_timer *timer)
78 afs_put_server(oldserver); 77 afs_put_server(oldserver);
79 78
80 _leave(""); 79 _leave("");
81} /* end afs_vnode_cb_timed_out() */ 80}
82 81
83/*****************************************************************************/
84/* 82/*
85 * finish off updating the recorded status of a file 83 * finish off updating the recorded status of a file
86 * - starts callback expiry timer 84 * - starts callback expiry timer
@@ -105,7 +103,7 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
105 103
106 spin_lock(&afs_cb_hash_lock); 104 spin_lock(&afs_cb_hash_lock);
107 list_move_tail(&vnode->cb_hash_link, 105 list_move_tail(&vnode->cb_hash_link,
108 &afs_cb_hash(server, &vnode->fid)); 106 &afs_cb_hash(server, &vnode->fid));
109 spin_unlock(&afs_cb_hash_lock); 107 spin_unlock(&afs_cb_hash_lock);
110 108
111 /* swap ref to old callback server with that for new callback 109 /* swap ref to old callback server with that for new callback
@@ -122,13 +120,11 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
122 spin_lock(&server->cb_lock); 120 spin_lock(&server->cb_lock);
123 list_add_tail(&vnode->cb_link, &server->cb_promises); 121 list_add_tail(&vnode->cb_link, &server->cb_promises);
124 spin_unlock(&server->cb_lock); 122 spin_unlock(&server->cb_lock);
125 } 123 } else {
126 else {
127 /* same server */ 124 /* same server */
128 oldserver = NULL; 125 oldserver = NULL;
129 } 126 }
130 } 127 } else if (ret == -ENOENT) {
131 else if (ret == -ENOENT) {
132 /* the file was deleted - clear the callback timeout */ 128 /* the file was deleted - clear the callback timeout */
133 oldserver = xchg(&vnode->cb_server, NULL); 129 oldserver = xchg(&vnode->cb_server, NULL);
134 afs_kafstimod_del_timer(&vnode->cb_timeout); 130 afs_kafstimod_del_timer(&vnode->cb_timeout);
@@ -146,10 +142,8 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
146 afs_put_server(oldserver); 142 afs_put_server(oldserver);
147 143
148 _leave(""); 144 _leave("");
145}
149 146
150} /* end afs_vnode_finalise_status_update() */
151
152/*****************************************************************************/
153/* 147/*
154 * fetch file status from the volume 148 * fetch file status from the volume
155 * - don't issue a fetch if: 149 * - don't issue a fetch if:
@@ -222,7 +216,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode)
222 return vnode->flags & AFS_VNODE_DELETED ? -ENOENT : 0; 216 return vnode->flags & AFS_VNODE_DELETED ? -ENOENT : 0;
223 } 217 }
224 218
225 get_anyway: 219get_anyway:
226 /* okay... we're going to have to initiate the op */ 220 /* okay... we're going to have to initiate the op */
227 vnode->update_cnt++; 221 vnode->update_cnt++;
228 222
@@ -247,9 +241,8 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode)
247 241
248 _leave(" = %d", ret); 242 _leave(" = %d", ret);
249 return ret; 243 return ret;
250} /* end afs_vnode_fetch_status() */ 244}
251 245
252/*****************************************************************************/
253/* 246/*
254 * fetch file data from the volume 247 * fetch file data from the volume
255 * - TODO implement caching and server failover 248 * - TODO implement caching and server failover
@@ -290,10 +283,8 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode,
290 283
291 _leave(" = %d", ret); 284 _leave(" = %d", ret);
292 return ret; 285 return ret;
286}
293 287
294} /* end afs_vnode_fetch_data() */
295
296/*****************************************************************************/
297/* 288/*
298 * break any outstanding callback on a vnode 289 * break any outstanding callback on a vnode
299 * - only relevent to server that issued it 290 * - only relevent to server that issued it
@@ -337,9 +328,8 @@ int afs_vnode_give_up_callback(struct afs_vnode *vnode)
337 328
338 _leave(" = %d", ret); 329 _leave(" = %d", ret);
339 return ret; 330 return ret;
340} /* end afs_vnode_give_up_callback() */ 331}
341 332
342/*****************************************************************************/
343/* 333/*
344 * match a vnode record stored in the cache 334 * match a vnode record stored in the cache
345 */ 335 */
@@ -371,10 +361,9 @@ static cachefs_match_val_t afs_vnode_cache_match(void *target,
371 361
372 _leave(" = SUCCESS"); 362 _leave(" = SUCCESS");
373 return CACHEFS_MATCH_SUCCESS; 363 return CACHEFS_MATCH_SUCCESS;
374} /* end afs_vnode_cache_match() */ 364}
375#endif 365#endif
376 366
377/*****************************************************************************/
378/* 367/*
379 * update a vnode record stored in the cache 368 * update a vnode record stored in the cache
380 */ 369 */
@@ -389,6 +378,5 @@ static void afs_vnode_cache_update(void *source, void *entry)
389 cvnode->vnode_id = vnode->fid.vnode; 378 cvnode->vnode_id = vnode->fid.vnode;
390 cvnode->vnode_unique = vnode->fid.unique; 379 cvnode->vnode_unique = vnode->fid.unique;
391 cvnode->data_version = vnode->status.version; 380 cvnode->data_version = vnode->status.version;
392 381}
393} /* end afs_vnode_cache_update() */
394#endif 382#endif
diff --git a/fs/afs/vnode.h b/fs/afs/vnode.h
index b86a97102e8b..7f6d05b197a6 100644
--- a/fs/afs/vnode.h
+++ b/fs/afs/vnode.h
@@ -1,4 +1,4 @@
1/* vnode.h: AFS vnode record 1/* AFS vnode record
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,24 +9,22 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_VNODE_H 12#ifndef AFS_VNODE_H
13#define _LINUX_AFS_VNODE_H 13#define AFS_VNODE_H
14 14
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include "server.h" 16#include "server.h"
17#include "kafstimod.h" 17#include "kafstimod.h"
18#include "cache.h" 18#include "cache.h"
19 19
20#ifdef __KERNEL__
21
22struct afs_rxfs_fetch_descriptor; 20struct afs_rxfs_fetch_descriptor;
23 21
24/*****************************************************************************/ 22extern struct afs_timer_ops afs_vnode_cb_timed_out_ops;
23
25/* 24/*
26 * vnode catalogue entry 25 * vnode catalogue entry
27 */ 26 */
28struct afs_cache_vnode 27struct afs_cache_vnode {
29{
30 afs_vnodeid_t vnode_id; /* vnode ID */ 28 afs_vnodeid_t vnode_id; /* vnode ID */
31 unsigned vnode_unique; /* vnode ID uniquifier */ 29 unsigned vnode_unique; /* vnode ID uniquifier */
32 afs_dataversion_t data_version; /* data version */ 30 afs_dataversion_t data_version; /* data version */
@@ -36,12 +34,10 @@ struct afs_cache_vnode
36extern struct cachefs_index_def afs_vnode_cache_index_def; 34extern struct cachefs_index_def afs_vnode_cache_index_def;
37#endif 35#endif
38 36
39/*****************************************************************************/
40/* 37/*
41 * AFS inode private data 38 * AFS inode private data
42 */ 39 */
43struct afs_vnode 40struct afs_vnode {
44{
45 struct inode vfs_inode; /* the VFS's inode record */ 41 struct inode vfs_inode; /* the VFS's inode record */
46 42
47 struct afs_volume *volume; /* volume on which vnode resides */ 43 struct afs_volume *volume; /* volume on which vnode resides */
@@ -72,7 +68,7 @@ struct afs_vnode
72 68
73static inline struct afs_vnode *AFS_FS_I(struct inode *inode) 69static inline struct afs_vnode *AFS_FS_I(struct inode *inode)
74{ 70{
75 return container_of(inode,struct afs_vnode,vfs_inode); 71 return container_of(inode, struct afs_vnode, vfs_inode);
76} 72}
77 73
78static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode) 74static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
@@ -80,15 +76,9 @@ static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
80 return &vnode->vfs_inode; 76 return &vnode->vfs_inode;
81} 77}
82 78
83extern int afs_vnode_fetch_status(struct afs_vnode *vnode); 79extern int afs_vnode_fetch_status(struct afs_vnode *);
84 80extern int afs_vnode_fetch_data(struct afs_vnode *,
85extern int afs_vnode_fetch_data(struct afs_vnode *vnode, 81 struct afs_rxfs_fetch_descriptor *);
86 struct afs_rxfs_fetch_descriptor *desc); 82extern int afs_vnode_give_up_callback(struct afs_vnode *);
87
88extern int afs_vnode_give_up_callback(struct afs_vnode *vnode);
89
90extern struct afs_timer_ops afs_vnode_cb_timed_out_ops;
91
92#endif /* __KERNEL__ */
93 83
94#endif /* _LINUX_AFS_VNODE_H */ 84#endif /* AFS_VNODE_H */
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index 768c6dbd323a..c82e1bb4f2dd 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -1,4 +1,4 @@
1/* volume.c: AFS volume management 1/* AFS volume management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -43,7 +43,6 @@ struct cachefs_index_def afs_volume_cache_index_def = {
43}; 43};
44#endif 44#endif
45 45
46/*****************************************************************************/
47/* 46/*
48 * lookup a volume by name 47 * lookup a volume by name
49 * - this can be one of the following: 48 * - this can be one of the following:
@@ -97,14 +96,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
97 if (strcmp(suffix, ".readonly") == 0) { 96 if (strcmp(suffix, ".readonly") == 0) {
98 type = AFSVL_ROVOL; 97 type = AFSVL_ROVOL;
99 force = 1; 98 force = 1;
100 } 99 } else if (strcmp(suffix, ".backup") == 0) {
101 else if (strcmp(suffix, ".backup") == 0) {
102 type = AFSVL_BACKVOL; 100 type = AFSVL_BACKVOL;
103 force = 1; 101 force = 1;
104 } 102 } else if (suffix[1] == 0) {
105 else if (suffix[1] == 0) { 103 } else {
106 }
107 else {
108 suffix = NULL; 104 suffix = NULL;
109 } 105 }
110 } 106 }
@@ -116,8 +112,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
116 cellname = name; 112 cellname = name;
117 cellnamesz = volname - name; 113 cellnamesz = volname - name;
118 volname++; 114 volname++;
119 } 115 } else {
120 else {
121 volname = name; 116 volname = name;
122 cellname = NULL; 117 cellname = NULL;
123 cellnamesz = 0; 118 cellnamesz = 0;
@@ -139,8 +134,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
139 cellname ?: ""); 134 cellname ?: "");
140 goto error; 135 goto error;
141 } 136 }
142 } 137 } else {
143 else {
144 afs_get_cell(cell); 138 afs_get_cell(cell);
145 } 139 }
146 140
@@ -161,14 +155,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
161 if (force) { 155 if (force) {
162 if (!(srvtmask & (1 << type))) 156 if (!(srvtmask & (1 << type)))
163 goto error; 157 goto error;
164 } 158 } else if (srvtmask & AFS_VOL_VTM_RO) {
165 else if (srvtmask & AFS_VOL_VTM_RO) {
166 type = AFSVL_ROVOL; 159 type = AFSVL_ROVOL;
167 } 160 } else if (srvtmask & AFS_VOL_VTM_RW) {
168 else if (srvtmask & AFS_VOL_VTM_RW) {
169 type = AFSVL_RWVOL; 161 type = AFSVL_RWVOL;
170 } 162 } else {
171 else {
172 goto error; 163 goto error;
173 } 164 }
174 165
@@ -225,23 +216,23 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
225 216
226 vlocation->vols[type] = volume; 217 vlocation->vols[type] = volume;
227 218
228 success: 219success:
229 _debug("kAFS selected %s volume %08x", 220 _debug("kAFS selected %s volume %08x",
230 afs_voltypes[volume->type], volume->vid); 221 afs_voltypes[volume->type], volume->vid);
231 *_volume = volume; 222 *_volume = volume;
232 ret = 0; 223 ret = 0;
233 224
234 /* clean up */ 225 /* clean up */
235 error_up: 226error_up:
236 up_write(&cell->vl_sem); 227 up_write(&cell->vl_sem);
237 error: 228error:
238 afs_put_vlocation(vlocation); 229 afs_put_vlocation(vlocation);
239 afs_put_cell(cell); 230 afs_put_cell(cell);
240 231
241 _leave(" = %d (%p)", ret, volume); 232 _leave(" = %d (%p)", ret, volume);
242 return ret; 233 return ret;
243 234
244 error_discard: 235error_discard:
245 up_write(&cell->vl_sem); 236 up_write(&cell->vl_sem);
246 237
247 for (loop = volume->nservers - 1; loop >= 0; loop--) 238 for (loop = volume->nservers - 1; loop >= 0; loop--)
@@ -249,9 +240,8 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
249 240
250 kfree(volume); 241 kfree(volume);
251 goto error; 242 goto error;
252} /* end afs_volume_lookup() */ 243}
253 244
254/*****************************************************************************/
255/* 245/*
256 * destroy a volume record 246 * destroy a volume record
257 */ 247 */
@@ -296,9 +286,8 @@ void afs_put_volume(struct afs_volume *volume)
296 kfree(volume); 286 kfree(volume);
297 287
298 _leave(" [destroyed]"); 288 _leave(" [destroyed]");
299} /* end afs_put_volume() */ 289}
300 290
301/*****************************************************************************/
302/* 291/*
303 * pick a server to use to try accessing this volume 292 * pick a server to use to try accessing this volume
304 * - returns with an elevated usage count on the server chosen 293 * - returns with an elevated usage count on the server chosen
@@ -373,9 +362,8 @@ int afs_volume_pick_fileserver(struct afs_volume *volume,
373 up_read(&volume->server_sem); 362 up_read(&volume->server_sem);
374 _leave(" = %d", ret); 363 _leave(" = %d", ret);
375 return ret; 364 return ret;
376} /* end afs_volume_pick_fileserver() */ 365}
377 366
378/*****************************************************************************/
379/* 367/*
380 * release a server after use 368 * release a server after use
381 * - releases the ref on the server struct that was acquired by picking 369 * - releases the ref on the server struct that was acquired by picking
@@ -469,16 +457,14 @@ int afs_volume_release_fileserver(struct afs_volume *volume,
469 return 1; 457 return 1;
470 458
471 /* tell the caller to loop around and try the next server */ 459 /* tell the caller to loop around and try the next server */
472 try_next_server_upw: 460try_next_server_upw:
473 up_write(&volume->server_sem); 461 up_write(&volume->server_sem);
474 try_next_server: 462try_next_server:
475 afs_put_server(server); 463 afs_put_server(server);
476 _leave(" [try next server]"); 464 _leave(" [try next server]");
477 return 0; 465 return 0;
466}
478 467
479} /* end afs_volume_release_fileserver() */
480
481/*****************************************************************************/
482/* 468/*
483 * match a volume hash record stored in the cache 469 * match a volume hash record stored in the cache
484 */ 470 */
@@ -498,10 +484,9 @@ static cachefs_match_val_t afs_volume_cache_match(void *target,
498 484
499 _leave(" = FAILED"); 485 _leave(" = FAILED");
500 return CACHEFS_MATCH_FAILED; 486 return CACHEFS_MATCH_FAILED;
501} /* end afs_volume_cache_match() */ 487}
502#endif 488#endif
503 489
504/*****************************************************************************/
505/* 490/*
506 * update a volume hash record stored in the cache 491 * update a volume hash record stored in the cache
507 */ 492 */
@@ -514,6 +499,5 @@ static void afs_volume_cache_update(void *source, void *entry)
514 _enter(""); 499 _enter("");
515 500
516 vhash->vtype = volume->type; 501 vhash->vtype = volume->type;
517 502}
518} /* end afs_volume_cache_update() */
519#endif 503#endif
diff --git a/fs/afs/volume.h b/fs/afs/volume.h
index bfdcf19ba3f3..a605bea2e3a0 100644
--- a/fs/afs/volume.h
+++ b/fs/afs/volume.h
@@ -1,4 +1,4 @@
1/* volume.h: AFS volume management 1/* AFS volume management
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_AFS_VOLUME_H 12#ifndef AFS_VOLUME_H
13#define _LINUX_AFS_VOLUME_H 13#define AFS_VOLUME_H
14 14
15#include "types.h" 15#include "types.h"
16#include "fsclient.h" 16#include "fsclient.h"
@@ -23,15 +23,12 @@ typedef enum {
23 AFS_VLUPD_PENDING, /* on pending queue */ 23 AFS_VLUPD_PENDING, /* on pending queue */
24 AFS_VLUPD_INPROGRESS, /* op in progress */ 24 AFS_VLUPD_INPROGRESS, /* op in progress */
25 AFS_VLUPD_BUSYSLEEP, /* sleeping because server returned EBUSY */ 25 AFS_VLUPD_BUSYSLEEP, /* sleeping because server returned EBUSY */
26
27} __attribute__((packed)) afs_vlocation_upd_t; 26} __attribute__((packed)) afs_vlocation_upd_t;
28 27
29/*****************************************************************************/
30/* 28/*
31 * entry in the cached volume location catalogue 29 * entry in the cached volume location catalogue
32 */ 30 */
33struct afs_cache_vlocation 31struct afs_cache_vlocation {
34{
35 uint8_t name[64]; /* volume name (lowercase, padded with NULs) */ 32 uint8_t name[64]; /* volume name (lowercase, padded with NULs) */
36 uint8_t nservers; /* number of entries used in servers[] */ 33 uint8_t nservers; /* number of entries used in servers[] */
37 uint8_t vidmask; /* voltype mask for vid[] */ 34 uint8_t vidmask; /* voltype mask for vid[] */
@@ -49,12 +46,10 @@ struct afs_cache_vlocation
49extern struct cachefs_index_def afs_vlocation_cache_index_def; 46extern struct cachefs_index_def afs_vlocation_cache_index_def;
50#endif 47#endif
51 48
52/*****************************************************************************/
53/* 49/*
54 * volume -> vnode hash table entry 50 * volume -> vnode hash table entry
55 */ 51 */
56struct afs_cache_vhash 52struct afs_cache_vhash {
57{
58 afs_voltype_t vtype; /* which volume variation */ 53 afs_voltype_t vtype; /* which volume variation */
59 uint8_t hash_bucket; /* which hash bucket this represents */ 54 uint8_t hash_bucket; /* which hash bucket this represents */
60} __attribute__((packed)); 55} __attribute__((packed));
@@ -63,12 +58,10 @@ struct afs_cache_vhash
63extern struct cachefs_index_def afs_volume_cache_index_def; 58extern struct cachefs_index_def afs_volume_cache_index_def;
64#endif 59#endif
65 60
66/*****************************************************************************/
67/* 61/*
68 * AFS volume location record 62 * AFS volume location record
69 */ 63 */
70struct afs_vlocation 64struct afs_vlocation {
71{
72 atomic_t usage; 65 atomic_t usage;
73 struct list_head link; /* link in cell volume location list */ 66 struct list_head link; /* link in cell volume location list */
74 struct afs_timer timeout; /* decaching timer */ 67 struct afs_timer timeout; /* decaching timer */
@@ -90,22 +83,18 @@ struct afs_vlocation
90 unsigned short valid; /* T if valid */ 83 unsigned short valid; /* T if valid */
91}; 84};
92 85
93extern int afs_vlocation_lookup(struct afs_cell *cell, 86extern int afs_vlocation_lookup(struct afs_cell *, const char *, unsigned,
94 const char *name, 87 struct afs_vlocation **);
95 unsigned namesz,
96 struct afs_vlocation **_vlocation);
97 88
98#define afs_get_vlocation(V) do { atomic_inc(&(V)->usage); } while(0) 89#define afs_get_vlocation(V) do { atomic_inc(&(V)->usage); } while(0)
99 90
100extern void afs_put_vlocation(struct afs_vlocation *vlocation); 91extern void afs_put_vlocation(struct afs_vlocation *);
101extern void afs_vlocation_do_timeout(struct afs_vlocation *vlocation); 92extern void afs_vlocation_do_timeout(struct afs_vlocation *);
102 93
103/*****************************************************************************/
104/* 94/*
105 * AFS volume access record 95 * AFS volume access record
106 */ 96 */
107struct afs_volume 97struct afs_volume {
108{
109 atomic_t usage; 98 atomic_t usage;
110 struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */ 99 struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */
111 struct afs_vlocation *vlocation; /* volume location */ 100 struct afs_vlocation *vlocation; /* volume location */
@@ -121,20 +110,17 @@ struct afs_volume
121 struct rw_semaphore server_sem; /* lock for accessing current server */ 110 struct rw_semaphore server_sem; /* lock for accessing current server */
122}; 111};
123 112
124extern int afs_volume_lookup(const char *name, 113extern int afs_volume_lookup(const char *, struct afs_cell *, int,
125 struct afs_cell *cell, 114 struct afs_volume **);
126 int rwpath,
127 struct afs_volume **_volume);
128 115
129#define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0) 116#define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0)
130 117
131extern void afs_put_volume(struct afs_volume *volume); 118extern void afs_put_volume(struct afs_volume *);
132 119
133extern int afs_volume_pick_fileserver(struct afs_volume *volume, 120extern int afs_volume_pick_fileserver(struct afs_volume *,
134 struct afs_server **_server); 121 struct afs_server **);
135 122
136extern int afs_volume_release_fileserver(struct afs_volume *volume, 123extern int afs_volume_release_fileserver(struct afs_volume *,
137 struct afs_server *server, 124 struct afs_server *, int);
138 int result);
139 125
140#endif /* _LINUX_AFS_VOLUME_H */ 126#endif /* AFS_VOLUME_H */