Skip to contentSkip to conversation

btrfs: fix a wrong error check in add_ra_bio_pages()

PATCH In review Miao Xie 2 participants 3 messages Jul 29, 2010 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 7/7 btrfs: fix a wrong error check in add_ra_bio_pages()

From: Liu Bo <[email protected]>

Only when a page is not found by page_index, we'll go to the error check.

---
 fs/btrfs/compression.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/compression.c +1 -1
index cb3877c..8458840 100644
@@ -467,7 +467,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
 		rcu_read_lock();
 		page = radix_tree_lookup(&mapping->page_tree, page_index);
 		rcu_read_unlock();
-		if (page) {
+		if (!page) {
 check_misses:
 			misses++;
 			if (misses > 4)
Signature · 1 line
1.7.0.1
#1 lore raw

2010/7/29 Miao Xie <[email protected]>:

Quoted 3 lines

From: Liu Bo <[email protected]>

Only when a page is not found by page_index, we'll go to the error ch=

eck.

fs/btrfs/compression.c static noinline int add_ra_bio_pages(struct inode=

Quoted 12 lines

---
=A0fs/btrfs/compression.c | =A0 =A02 +- =A01 files changed, 1 insertions(+), 1 deletions(-)

fs/btrfs/compression.c +0 -0
index cb3877c..8458840 100644
@@ -467,7 +467,7 @@ static noinline int add_ra_bio_pages(struct inode=

*inode,

Quoted 2 lines
fs/btrfs/compression.c +0 -0
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rcu_read_lock();

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page =3D radix_tree_lookup(&mapping->p=

age_tree, page_index);

Quoted 6 lines

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rcu_read_unlock();
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (page) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!page) { =A0check_misses:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0misses++; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (misses > 4)

This patch is wrong. The word "miss" here means "miss for read-ahead be= cause
the page is already in the page cache"

Yan, Zheng

author
#2 lore raw
Quoted 11 lines · Zheng

2010/7/29 Miao Xie<[email protected]>:

Quoted 10 lines

From: Liu Bo<[email protected]>

Only when a page is not found by page_index, we'll go to the error check.

---
  fs/btrfs/compression.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines

fs/btrfs/compression.c static noinline int add_ra_bio_pages(struct inode *inode, · line 473

Quoted 13 lines
fs/btrfs/compression.c +1 -1
index cb3877c..8458840 100644
@@ -467,7 +467,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
                rcu_read_lock();
                page = radix_tree_lookup(&mapping->page_tree, page_index);
                rcu_read_unlock();
-               if (page) {
+               if (!page) {
  check_misses:
                        misses++;
                        if (misses>  4)

This patch is wrong. The word "miss" here means "miss for read-ahead because the page is already in the page cache"

Oh, my mistake. Sorry!
Please ignore this patch.

Thanks for your review! How about the others?
Miao

Quoted 4 lines

Yan, Zheng