diff options
Diffstat (limited to 'fs/afs/volume.c')
-rw-r--r-- | fs/afs/volume.c | 58 |
1 files changed, 21 insertions, 37 deletions
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: | 219 | success: |
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: | 226 | error_up: |
236 | up_write(&cell->vl_sem); | 227 | up_write(&cell->vl_sem); |
237 | error: | 228 | error: |
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: | 235 | error_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: | 460 | try_next_server_upw: |
473 | up_write(&volume->server_sem); | 461 | up_write(&volume->server_sem); |
474 | try_next_server: | 462 | try_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 |