Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143821
b: refs/heads/master
c: 8c594ea
h: refs/heads/master
i:
  143819: 14c6d58
v: v3
  • Loading branch information
Chris Mason committed Apr 20, 2009
1 parent fa93993 commit 409a432
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 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: 11c8349b4eb68f2b04cd8ece577377e6c0e5dd4b
refs/heads/master: 8c594ea81d7abbbffdda447b127f8ba8d76f319d
17 changes: 12 additions & 5 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,12 +1325,12 @@ static noinline int reada_for_balance(struct btrfs_root *root,
int ret = 0;
int blocksize;

parent = path->nodes[level - 1];
parent = path->nodes[level + 1];
if (!parent)
return 0;

nritems = btrfs_header_nritems(parent);
slot = path->slots[level];
slot = path->slots[level + 1];
blocksize = btrfs_level_size(root, level);

if (slot > 0) {
Expand All @@ -1341,7 +1341,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
block1 = 0;
free_extent_buffer(eb);
}
if (slot < nritems) {
if (slot + 1 < nritems) {
block2 = btrfs_node_blockptr(parent, slot + 1);
gen = btrfs_node_ptr_generation(parent, slot + 1);
eb = btrfs_find_tree_block(root, block2, blocksize);
Expand All @@ -1351,7 +1351,11 @@ static noinline int reada_for_balance(struct btrfs_root *root,
}
if (block1 || block2) {
ret = -EAGAIN;

/* release the whole path */
btrfs_release_path(root, path);

/* read the blocks */
if (block1)
readahead_tree_block(root, block1, blocksize, 0);
if (block2)
Expand All @@ -1361,7 +1365,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
eb = read_tree_block(root, block1, blocksize, 0);
free_extent_buffer(eb);
}
if (block1) {
if (block2) {
eb = read_tree_block(root, block2, blocksize, 0);
free_extent_buffer(eb);
}
Expand Down Expand Up @@ -1481,12 +1485,15 @@ read_block_for_search(struct btrfs_trans_handle *trans,
* of the btree by dropping locks before
* we read.
*/
btrfs_release_path(NULL, p);
btrfs_unlock_up_safe(p, level + 1);
btrfs_set_path_blocking(p);

if (tmp)
free_extent_buffer(tmp);
if (p->reada)
reada_for_search(root, p, level, slot, key->objectid);

btrfs_release_path(NULL, p);
tmp = read_tree_block(root, blocknr, blocksize, gen);
if (tmp)
free_extent_buffer(tmp);
Expand Down

0 comments on commit 409a432

Please sign in to comment.