Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253082
b: refs/heads/master
c: cb25c2e
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik committed May 23, 2011
1 parent 923f48e commit 9ab1255
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 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: af60bed24eb0e3b6d93eaa6bb395a5721e6c09a8
refs/heads/master: cb25c2ea6a79702ab7895b873c6c43e0d3bc3c72
23 changes: 21 additions & 2 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@ static void reada_for_search(struct btrfs_root *root,
u64 search;
u64 target;
u64 nread = 0;
u64 gen;
int direction = path->reada;
struct extent_buffer *eb;
u32 nr;
Expand Down Expand Up @@ -1256,6 +1257,15 @@ static void reada_for_search(struct btrfs_root *root,
nritems = btrfs_header_nritems(node);
nr = slot;
while (1) {
if (!node->map_token) {
unsigned long offset = btrfs_node_key_ptr_offset(nr);
map_private_extent_buffer(node, offset,
sizeof(struct btrfs_key_ptr),
&node->map_token,
&node->kaddr,
&node->map_start,
&node->map_len, KM_USER1);
}
if (direction < 0) {
if (nr == 0)
break;
Expand All @@ -1273,14 +1283,23 @@ static void reada_for_search(struct btrfs_root *root,
search = btrfs_node_blockptr(node, nr);
if ((search <= target && target - search <= 65536) ||
(search > target && search - target <= 65536)) {
readahead_tree_block(root, search, blocksize,
btrfs_node_ptr_generation(node, nr));
gen = btrfs_node_ptr_generation(node, nr);
if (node->map_token) {
unmap_extent_buffer(node, node->map_token,
KM_USER1);
node->map_token = NULL;
}
readahead_tree_block(root, search, blocksize, gen);
nread += blocksize;
}
nscan++;
if ((nread > 65536 || nscan > 32))
break;
}
if (node->map_token) {
unmap_extent_buffer(node, node->map_token, KM_USER1);
node->map_token = NULL;
}
}

/*
Expand Down

0 comments on commit 9ab1255

Please sign in to comment.