• David Sterba's avatar
    btrfs: speed up btrfs_get_##bits helpers · 1441ed9b
    David Sterba authored
    The helpers unconditionally call map_private_extent_buffer to get the
    address of page containing the requested offset plus the mapping start
    and length. Depending on the return value, the fast path uses unaligned
    read to get data within a page, or fall back to read_extent_buffer that
    can handle reads spanning more pages.
    
    This is all wasteful. We know the number of bytes to read, 1/2/4/8 and
    can find out the page. Then simply check if it's contained or the
    fallback is needed.
    
    This saves one function call to map_private_extent_buffer and several
    unnecessary temporary variables.
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1441ed9b
struct-funcs.c 5.96 KB