diff options
author | David Howells <dhowells@redhat.com> | 2020-04-30 01:03:49 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2020-06-04 15:37:57 +0100 |
commit | 20325960f8750165964a6891a733e4cc15d19076 (patch) | |
tree | d372bb21037626d2fac40b9a1e6e6bea21786b8e /fs/afs/vl_alias.c | |
parent | cca37d45d547434144409ae648a19b7eb6db5eb4 (diff) |
afs: Reorganise volume and server trees to be rooted on the cell
Reorganise afs_volume objects such that they're in a tree keyed on volume
ID, rooted at on an afs_cell object rather than being in multiple trees,
each of which is rooted on an afs_server object.
afs_server structs become per-cell and acquire a pointer to the cell.
The process of breaking a callback then starts with finding the server by
its network address, following that to the cell and then looking up each
volume ID in the volume tree.
This is simpler than the afs_vol_interest/afs_cb_interest N:M mapping web
and allows those structs and the code for maintaining them to be simplified
or removed.
It does make a couple of things a bit more tricky, though:
(1) Operations now start with a volume, not a server, so there can be more
than one answer as to whether or not the server we'll end up using
supports the FS.InlineBulkStatus RPC.
(2) CB RPC operations that specify the server UUID. There's still a tree
of servers by UUID on the afs_net struct, but the UUIDs in it aren't
guaranteed unique.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/vl_alias.c')
-rw-r--r-- | fs/afs/vl_alias.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/afs/vl_alias.c b/fs/afs/vl_alias.c index c61dd9410202..093895c49c21 100644 --- a/fs/afs/vl_alias.c +++ b/fs/afs/vl_alias.c @@ -189,13 +189,13 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key, struct afs_volume *volume, *pvol = NULL; int ret; - /* Arbitrarily pick the first volume in the list. */ - read_lock(&p->proc_lock); - if (!list_empty(&p->proc_volumes)) - pvol = afs_get_volume(list_first_entry(&p->proc_volumes, - struct afs_volume, proc_link), + /* Arbitrarily pick a volume from the list. */ + read_seqlock_excl(&p->volume_lock); + if (!RB_EMPTY_ROOT(&p->volumes)) + pvol = afs_get_volume(rb_entry(p->volumes.rb_node, + struct afs_volume, cell_node), afs_volume_trace_get_query_alias); - read_unlock(&p->proc_lock); + read_sequnlock_excl(&p->volume_lock); if (!pvol) return 0; @@ -242,7 +242,7 @@ static int afs_query_for_alias(struct afs_cell *cell, struct key *key) hlist_for_each_entry(p, &cell->net->proc_cells, proc_link) { if (p == cell || p->alias_of) continue; - if (list_empty(&p->proc_volumes)) + if (RB_EMPTY_ROOT(&p->volumes)) continue; if (p->root_volume) continue; /* Ignore cells that have a root.cell volume. */ |