diff options
Diffstat (limited to 'fs/afs/cell.c')
-rw-r--r-- | fs/afs/cell.c | 51 |
1 files changed, 18 insertions, 33 deletions
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: | 139 | badaddr: |
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: | 141 | error: |
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: | 403 | found_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: | 411 | found_server: |
423 | afs_get_server(server); | 412 | afs_get_server(server); |
424 | 413 | ||
425 | success: | 414 | success: |
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 |