• David Howells's avatar
    afs: Make callback processing more efficient. · 8230fd82
    David Howells authored
    afs_vol_interest objects represent the volume IDs currently being accessed
    from a fileserver.  These hold lists of afs_cb_interest objects that
    repesent the superblocks using that volume ID on that server.
    
    When a callback notification from the server telling of a modification by
    another client arrives, the volume ID specified in the notification is
    looked up in the server's afs_vol_interest list.  Through the
    afs_cb_interest list, the relevant superblocks can be iterated over and the
    specific inode looked up and marked in each one.
    
    Make the following efficiency improvements:
    
     (1) Hold rcu_read_lock() over the entire processing rather than locking it
         each time.
    
     (2) Do all the callbacks for each vid together rather than individually.
         Each volume then only needs to be looked up once.
    
     (3) afs_vol_interest objects are now stored in an rb_tree rather than a
         flat list to reduce the lookup step count.
    
     (4) afs_vol_interest lookup is now done with RCU, but because it's in an
         rb_tree which may rotate under us, a seqlock is used so that if it
         changes during the walk, we repeat the walk with a lock held.
    
    With this and the preceding patch which adds RCU-based lookups in the inode
    cache, target volumes/vnodes can be taken without the need to take any
    locks, except on the target itself.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    8230fd82
internal.h 53.8 KB