Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131048
b: refs/heads/master
c: a717531
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Jan 22, 2009
1 parent ca1ab38 commit a8afff3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1506fcc8189cdd4b95e06df7845a09f18b4526a6
refs/heads/master: a717531942f488209dded30f6bc648167bcefa72
21 changes: 5 additions & 16 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
struct btrfs_disk_key disk_key;
u32 nritems;
u64 search;
u64 lowest_read;
u64 highest_read;
u64 target;
u64 nread = 0;
int direction = path->reada;
struct extent_buffer *eb;
Expand All @@ -1235,8 +1234,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
return;
}

highest_read = search;
lowest_read = search;
target = search;

nritems = btrfs_header_nritems(node);
nr = slot;
Expand All @@ -1256,24 +1254,15 @@ static noinline void reada_for_search(struct btrfs_root *root,
break;
}
search = btrfs_node_blockptr(node, nr);
if ((search >= lowest_read && search <= highest_read) ||
(search < lowest_read && lowest_read - search <= 16384) ||
(search > highest_read && search - highest_read <= 16384)) {
if ((search <= target && target - search <= 65536) ||
(search > target && search - target <= 65536)) {
readahead_tree_block(root, search, blocksize,
btrfs_node_ptr_generation(node, nr));
nread += blocksize;
}
nscan++;
if (path->reada < 2 && (nread > (64 * 1024) || nscan > 32))
if ((nread > 65536 || nscan > 32))
break;

if (nread > (256 * 1024) || nscan > 128)
break;

if (search < lowest_read)
lowest_read = search;
if (search > highest_read)
highest_read = search;
}
}

Expand Down

0 comments on commit a8afff3

Please sign in to comment.