aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-02-06 01:26:30 -0500
committerDavid Howells <dhowells@redhat.com>2018-02-06 09:43:37 -0500
commit16280a15be751b9994e94c5dc944e93fa4293199 (patch)
tree389dbe6bfc16da30f4f43f6e36be0ba123fac6fb
parent63dc4e4aa5ab61868199960979fe1feecdabd01e (diff)
afs: Rearrange afs_select_fileserver() a little
Rearrange afs_select_fileserver() a little to put the use_server chunk before the next_server chunk so that with the removal of a couple of gotos the main path through the function is all one sequence. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--fs/afs/rotate.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c
index cfe0931e7844..ad1328d85526 100644
--- a/fs/afs/rotate.c
+++ b/fs/afs/rotate.c
@@ -330,27 +330,6 @@ start:
330 330
331 if (!afs_start_fs_iteration(fc, vnode)) 331 if (!afs_start_fs_iteration(fc, vnode))
332 goto failed; 332 goto failed;
333 goto use_server;
334
335next_server:
336 _debug("next");
337 afs_end_cursor(&fc->ac);
338 afs_put_cb_interest(afs_v2net(vnode), fc->cbi);
339 fc->cbi = NULL;
340 fc->index++;
341 if (fc->index >= fc->server_list->nr_servers)
342 fc->index = 0;
343 if (fc->index != fc->start)
344 goto use_server;
345
346 /* That's all the servers poked to no good effect. Try again if some
347 * of them were busy.
348 */
349 if (fc->flags & AFS_FS_CURSOR_VBUSY)
350 goto restart_from_beginning;
351
352 fc->ac.error = -EDESTADDRREQ;
353 goto failed;
354 333
355use_server: 334use_server:
356 _debug("use"); 335 _debug("use");
@@ -401,7 +380,6 @@ use_server:
401 380
402 fc->ac.start = READ_ONCE(alist->index); 381 fc->ac.start = READ_ONCE(alist->index);
403 fc->ac.index = fc->ac.start; 382 fc->ac.index = fc->ac.start;
404 goto iterate_address;
405 383
406iterate_address: 384iterate_address:
407 ASSERT(fc->ac.alist); 385 ASSERT(fc->ac.alist);
@@ -415,6 +393,26 @@ iterate_address:
415 _leave(" = t"); 393 _leave(" = t");
416 return true; 394 return true;
417 395
396next_server:
397 _debug("next");
398 afs_end_cursor(&fc->ac);
399 afs_put_cb_interest(afs_v2net(vnode), fc->cbi);
400 fc->cbi = NULL;
401 fc->index++;
402 if (fc->index >= fc->server_list->nr_servers)
403 fc->index = 0;
404 if (fc->index != fc->start)
405 goto use_server;
406
407 /* That's all the servers poked to no good effect. Try again if some
408 * of them were busy.
409 */
410 if (fc->flags & AFS_FS_CURSOR_VBUSY)
411 goto restart_from_beginning;
412
413 fc->ac.error = -EDESTADDRREQ;
414 goto failed;
415
418failed: 416failed:
419 fc->flags |= AFS_FS_CURSOR_STOP; 417 fc->flags |= AFS_FS_CURSOR_STOP;
420 afs_end_cursor(&fc->ac); 418 afs_end_cursor(&fc->ac);