Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128579
b: refs/heads/master
c: 01f4665
h: refs/heads/master
i:
  128577: 158298d
  128575: cd0dc58
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 680dfe2 commit b57630a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 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: 879c1cfc3104b632dea85d07490f1b55e54275a9
refs/heads/master: 01f466580502c57001bf80fff709479fdb9e87a5
20 changes: 11 additions & 9 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,10 @@ static int push_nodes_for_insert(struct btrfs_trans_handle *trans,
* readahead one full node of leaves
*/
static void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
int level, int slot)
int level, int slot, u64 objectid)
{
struct extent_buffer *node;
struct btrfs_disk_key disk_key;
u32 nritems;
u64 search;
u64 lowest_read;
Expand Down Expand Up @@ -1031,6 +1032,11 @@ static void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
if (nr >= nritems)
break;
}
if (path->reada < 0 && objectid) {
btrfs_node_key(node, &disk_key, nr);
if (btrfs_disk_key_objectid(&disk_key) != objectid)
break;
}
search = btrfs_node_blockptr(node, nr);
if ((search >= lowest_read && search <= highest_read) ||
(search < lowest_read && lowest_read - search <= 32768) ||
Expand Down Expand Up @@ -1136,7 +1142,8 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
bytenr = btrfs_node_blockptr(b, slot);
ptr_gen = btrfs_node_ptr_generation(b, slot);
if (should_reada)
reada_for_search(root, p, level, slot);
reada_for_search(root, p, level, slot,
key->objectid);
b = read_tree_block(root, bytenr,
btrfs_level_size(root, level - 1));
if (ptr_gen != btrfs_header_generation(b)) {
Expand Down Expand Up @@ -2671,9 +2678,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
if (next)
free_extent_buffer(next);

if (path->reada < 0)
reada_for_search(root, path, level, slot);

next = read_tree_block(root, bytenr,
btrfs_level_size(root, level - 1));
break;
Expand All @@ -2687,8 +2691,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
path->slots[level] = 0;
if (!level)
break;
if (path->reada)
reada_for_search(root, path, level, 0);
next = read_tree_block(root, btrfs_node_blockptr(next, 0),
btrfs_level_size(root, level - 1));
}
Expand Down Expand Up @@ -2726,7 +2728,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
free_extent_buffer(next);

if (path->reada)
reada_for_search(root, path, level, slot);
reada_for_search(root, path, level, slot, 0);

next = read_tree_block(root, bytenr,
btrfs_level_size(root, level -1));
Expand All @@ -2742,7 +2744,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
if (!level)
break;
if (path->reada)
reada_for_search(root, path, level, 0);
reada_for_search(root, path, level, 0, 0);
next = read_tree_block(root, btrfs_node_blockptr(next, 0),
btrfs_level_size(root, level - 1));
}
Expand Down

0 comments on commit b57630a

Please sign in to comment.