Skip to content
  • Matthew Wilcox's avatar
    xarray: add the xa_lock to the radix_tree_root · f6bb2a2c
    Matthew Wilcox authored
    This results in no change in structure size on 64-bit machines as it
    fits in the padding between the gfp_t and the void *.  32-bit machines
    will grow the structure from 8 to 12 bytes.  Almost all radix trees are
    protected with (at least) a spinlock, so as they are converted from
    radix trees to xarrays, the data structures will shrink again.
    
    Initialising the spinlock requires a name for the benefit of lockdep, so
    RADIX_TREE_INIT() now needs to know the name of the radix tree it's
    initialising, and so do IDR_INIT() and IDA_INIT().
    
    Also add the xa_lock() and xa_unlock() family of wrappers to make it
    easier to use the lock.  If we could rely on -fplan9-extensions in the
    compiler, we could avoid all of this syntactic sugar, but that wasn't
    added until gcc 4.6.
    
    Link: http://lkml.kernel.org/r/20180313132639.17387-8-willy@infradead.org
    
    
    Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Cc: Darrick J. Wong <darrick....
    f6bb2a2c