All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4 RESEND] Btrfs: fix btrfs_release_extent_buffer_page with the right usage of num_extent_pages
@ 2012-04-06  6:35 Wang Sheng-Hui
  0 siblings, 0 replies; only message in thread
From: Wang Sheng-Hui @ 2012-04-06  6:35 UTC (permalink / raw)
  To: Chris Mason, linux-btrfs, linux-kernel

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: Wang Sheng-Hui <shhuiw@gmail.com>
---
 fs/btrfs/extent_io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5505356..ddfc1d5 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3975,11 +3975,13 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb,
 						unsigned long start_idx)
 {
 	unsigned long index;
+	unsigned long num_pages;
 	struct page *page;
 
 	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)
 		return;
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-06  6:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06  6:35 [PATCH 3/4 RESEND] Btrfs: fix btrfs_release_extent_buffer_page with the right usage of num_extent_pages Wang Sheng-Hui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.