• Qu Wenruo's avatar
    btrfs: pass bytenr directly to __process_pages_contig() · 98af9ab1
    Qu Wenruo authored
    As a preparation for incoming subpage support, we need bytenr passed to
    __process_pages_contig() directly, not the current page index.
    
    So change the parameter and all callers to pass bytenr in.
    
    With the modification, here we need to replace the old @index_ret with
    @processed_end for __process_pages_contig(), but this brings a small
    problem.
    
    Normally we follow the inclusive return value, meaning @processed_end
    should be the last byte we processed.
    
    If parameter @start is 0, and we failed to lock any page, then we would
    return @processed_end as -1, causing more problems for
    __unlock_for_delalloc().
    
    So here for @processed_end, we use two different return value patterns.
    If we have locked any page, @processed_end will be the last byte of
    locked page.
    Or it will be @start otherwise.
    
    This change will impact lock_delalloc_pages(), so it needs to check
    @processed_end to only unlock the range if we have locked any.
    
    Tested-by: Ritesh Harjani <riteshh@linux.ibm.com> # [ppc64]
    Tested-by: Anand Jain <anand.jain@oracle.com> # [aarch64]
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    98af9ab1
extent_io.c 187 KB