• Dave Chinner's avatar
    xfs: Pre-calculate per-AG agino geometry · 2d6ca832
    Dave Chinner authored
    There is a lot of overhead in functions like xfs_verify_agino() that
    repeatedly calculate the geometry limits of an AG. These can be
    pre-calculated as they are static and the verification context has
    a per-ag context it can quickly reference.
    
    In the case of xfs_verify_agino(), we now always have a perag
    context handy, so we can store the minimum and maximum agino values
    in the AG in the perag. This means we don't have to calculate
    it on every call and it can be inlined in callers if we move it
    to xfs_ag.h.
    
    xfs_verify_agino_or_null() gets the same perag treatment.
    
    xfs_agino_range() is moved to xfs_ag.c as it's not really a type
    function, and it's use is largely restricted as the first and last
    aginos can be grabbed straight from the perag in most cases.
    
    Note that we leave the original xfs_verify_agino in place in
    xfs_types.c as a static function as other callers in that file do
    not have per-ag contexts so still need to go the long way. It's been
    renamed to xfs_verify_agno_agino() to indicate it takes both an agno
    and an agino to differentiate it from new function.
    
    $ size --totals fs/xfs/built-in.a
    	   text    data     bss     dec     hex filename
    before	1482185	 329588	    572	1812345	 1ba779	(TOTALS)
    after	1481937	 329588	    572	1812097	 1ba681	(TOTALS)
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    2d6ca832
xfs_ialloc.c 79 KB