diff options
author | David Howells <dhowells@redhat.com> | 2023-10-30 14:53:16 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2024-01-01 19:37:27 +0300 |
commit | e6a7d7f71b17e0a44e2155bdad47eae7b5368503 (patch) | |
tree | 6279edcf2624cc9abcb55f15b1251828530ec195 /fs/afs/vl_probe.c | |
parent | 92f091cdddace38e57ad570663b058a38b4d8bed (diff) | |
download | linux-e6a7d7f71b17e0a44e2155bdad47eae7b5368503.tar.xz |
afs: Dispatch vlserver probes in priority order
When probing all the addresses for a volume location server, dispatch them
in order of descending priority to try and get back highest priority one
first.
Also add a tracepoint to show the transmission and completion of the
probes.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Diffstat (limited to 'fs/afs/vl_probe.c')
-rw-r--r-- | fs/afs/vl_probe.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/fs/afs/vl_probe.c b/fs/afs/vl_probe.c index f868ae5d40e5..b128dc3d8af7 100644 --- a/fs/afs/vl_probe.c +++ b/fs/afs/vl_probe.c @@ -131,6 +131,7 @@ responded: out: spin_unlock(&server->probe_lock); + trace_afs_vl_probe(server, false, alist, index, call->error, call->abort_code, rtt_us); _debug("probe [%u][%u] %pISpc rtt=%d ret=%d", server_index, index, rxrpc_kernel_remote_addr(addr->peer), rtt_us, ret); @@ -150,8 +151,10 @@ static bool afs_do_probe_vlserver(struct afs_net *net, { struct afs_addr_list *alist; struct afs_call *call; - unsigned int index; + unsigned long unprobed; + unsigned int index, i; bool in_progress = false; + int best_prio; _enter("%s", server->name); @@ -165,7 +168,20 @@ static bool afs_do_probe_vlserver(struct afs_net *net, memset(&server->probe, 0, sizeof(server->probe)); server->probe.rtt = UINT_MAX; - for (index = 0; index < alist->nr_addrs; index++) { + unprobed = (1UL << alist->nr_addrs) - 1; + while (unprobed) { + best_prio = -1; + index = 0; + for (i = 0; i < alist->nr_addrs; i++) { + if (test_bit(i, &unprobed) && + alist->addrs[i].prio > best_prio) { + index = i; + best_prio = alist->addrs[i].prio; + } + } + __clear_bit(index, &unprobed); + + trace_afs_vl_probe(server, true, alist, index, 0, 0, 0); call = afs_vl_get_capabilities(net, alist, index, key, server, server_index); if (!IS_ERR(call)) { |