Skip to content

Commit

Permalink
afs: Use op->nr_iterations=-1 to indicate to begin fileserver iteration
Browse files Browse the repository at this point in the history
Set op->nr_iterations to -1 to indicate that we need to begin fileserver
iteration rather than setting error to SHRT_MAX.  This makes it easier to
eliminate the address cursor.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
  • Loading branch information
David Howells committed Dec 24, 2023
1 parent eb8eae6 commit 075171f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fs/afs/fs_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo
op->cb_v_break = volume->cb_v_break;
op->debug_id = atomic_inc_return(&afs_operation_debug_counter);
op->error = -EDESTADDRREQ;
op->ac.error = SHRT_MAX;
op->nr_iterations = -1;

_leave(" = [op=%08x]", op->debug_id);
return op;
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ struct afs_operation {
struct afs_call *call;
unsigned long untried; /* Bitmask of untried servers */
short index; /* Current server */
unsigned short nr_iterations; /* Number of server iterations */
short nr_iterations; /* Number of server iterations */

unsigned int flags;
#define AFS_OPERATION_STOP 0x0001 /* Set to cease iteration */
Expand Down
11 changes: 6 additions & 5 deletions fs/afs/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ bool afs_select_fileserver(struct afs_operation *op)
unsigned int rtt;
int error = op->ac.error, i;

_enter("%lx[%d],%lx[%d],%d,%d",
op->nr_iterations++;

_enter("OP=%x+%x,%llx,%lx[%d],%lx[%d],%d,%d",
op->debug_id, op->nr_iterations, op->volume->vid,
op->untried, op->index,
op->ac.tried, op->ac.index,
error, op->ac.abort_code);
Expand All @@ -126,13 +129,11 @@ bool afs_select_fileserver(struct afs_operation *op)
return false;
}

op->nr_iterations++;
if (op->nr_iterations == 0)
goto start;

/* Evaluate the result of the previous operation, if there was one. */
switch (error) {
case SHRT_MAX:
goto start;

case 0:
default:
/* Success or local failure. Stop. */
Expand Down

0 comments on commit 075171f

Please sign in to comment.