Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39bab87b authored by Wang Sheng-Hui's avatar Wang Sheng-Hui Committed by Josef Bacik
Browse files

Btrfs: fix btrfs_release_extent_buffer_page with the right usage of num_extent_pages



num_extent_pages returns the number of pages in the specific range, not
the index of the last page in the eb range.

btrfs_release_extent_buffer_page is called with start_idx set 0 in current
codes, so it's not a problem yet. But the logic is indeed wrong.

Fix it here.

Signed-off-by: default avatarWang Sheng-Hui <shhuiw@gmail.com>
parent 1b303fc0
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -3981,11 +3981,13 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb,
						unsigned long start_idx)
						unsigned long start_idx)
{
{
	unsigned long index;
	unsigned long index;
	unsigned long num_pages;
	struct page *page;
	struct page *page;


	BUG_ON(extent_buffer_under_io(eb));
	BUG_ON(extent_buffer_under_io(eb));


	index = num_extent_pages(eb->start, eb->len);
	num_pages = num_extent_pages(eb->start, eb->len);
	index = start_idx + num_pages;
	if (start_idx >= index)
	if (start_idx >= index)
		return;
		return;