• Dave Chinner's avatar
    xfs: page type check in writeback only checks last buffer · 6ffc4db5
    Dave Chinner authored
    
    
    xfs_is_delayed_page() checks to see if a page has buffers matching
    the given IO type passed in. It does so by walking the buffer heads
    on the page and checking if the state flags match the IO type.
    
    However, the "acceptable" variable that is calculated is overwritten
    every time a new buffer is checked. Hence if the first buffer on the
    page is of the right type, this state is lost if the second buffer
    is not of the correct type. This means that xfs_aops_discard_page()
    may not discard delalloc regions when it is supposed to, and
    xfs_convert_page() may not cluster IO as efficiently as possible.
    
    This problem only occurs on filesystems with a block size smaller
    than page size.
    
    Also, rename xfs_is_delayed_page() to xfs_check_page_type() to
    better describe what it is doing - it is not delalloc specific
    anymore.
    
    The problem was first noticed by Peter Watkins.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
    Signed-off-by: default avatarBen Myers <bpm@sgi.com>
    6ffc4db5