• Nikolay Borisov's avatar
    btrfs: Don't trim returned range based on input value in find_first_clear_extent_bit · 1eaebb34
    Nikolay Borisov authored
    Currently find_first_clear_extent_bit always returns a range whose
    starting value is >= passed 'start'. This implicit trimming behavior is
    somewhat subtle and an implementation detail.
    Instead, this patch modifies the function such that now it always
    returns the range which contains passed 'start' and has the given bits
    unset. This range could either be due to presence of existing records
    which contains 'start' but have the bits unset or because there are no
    records that contain the given starting offset.
    This patch also adds test cases which cover find_first_clear_extent_bit
    since they were missing up until now.
    Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>