• Gao Xiang's avatar
    xfs: get rid of unnecessary xfs_perag_{get,put} pairs · 92a00544
    Gao Xiang authored
    In the course of some operations, we look up the perag from
    the mount multiple times to get or change perag information.
    These are often very short pieces of code, so while the
    lookup cost is generally low, the cost of the lookup is far
    higher than the cost of the operation we are doing on the
    perag.
    
    Since we changed buffers to hold references to the perag
    they are cached in, many modification contexts already hold
    active references to the perag that are held across these
    operations. This is especially true for any operation that
    is serialised by an allocation group header buffer.
    
    In these cases, we can just use the buffer's reference to
    the perag to avoid needing to do lookups to access the
    perag. This means that many operations don't need to do
    perag lookups at all to access the perag because they've
    already looked up objects that own persistent references
    and hence can use that reference instead.
    
    Cc: Dave Chinner <dchinner@redhat.com>
    Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
    Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    92a00544
xfs_inode.c 104 KB