]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Don't trim returned range based on input value in find_first_clear_extent_bit
authorNikolay Borisov <nborisov@suse.com>
Mon, 3 Jun 2019 10:06:02 +0000 (13:06 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 1 Jul 2019 11:35:02 +0000 (13:35 +0200)
commit3add8b78053f96b13fd910f1f12322545d089673
tree91ab17f1a296d66d5707c5063f1a61084611ae0d
parent4161d3add328a32673c4f2f10675786a1b66b9e6
btrfs: Don't trim returned range based on input value in find_first_clear_extent_bit

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: Qu Wenruo <wqu@suse.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/tests/extent-io-tests.c