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

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
...@@ -3981,11 +3981,13 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb, ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment