• Qu Wenruo's avatar
    btrfs: provide btrfs_page_clamp_*() helpers · 60e2d255
    Qu Wenruo authored
    In the coming subpage RW supports, there are a lot of page status update
    calls which need to be converted to subpage compatible version, which
    needs @start and @len.
    
    Some call sites already have such @start/@len and are already in
    page range, like various endio functions.
    
    But there are also call sites which need to clamp the range for subpage
    case, like btrfs_dirty_pagse() and __process_contig_pages().
    
    Here we introduce new helpers, btrfs_page_clamp_*(), to do and only do the
    clamp for subpage version.
    
    Although in theory all existing btrfs_page_*() calls can be converted to
    use btrfs_page_clamp_*() directly, but that would make us to do
    unnecessary clamp operations.
    
    Tested-by: Ritesh Harjani <riteshh@linux.ibm.com> # [ppc64]
    Tested-by: Anand Jain <anand.jain@oracle.com> # [aarch64]
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    60e2d255
subpage.h 3.66 KB