Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128817
b: refs/heads/master
c: f9efa9c
h: refs/heads/master
i:
  128815: 628a8fe
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 3c1c5e8 commit 67169a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 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: 3f157a2fd2ad731e1ed9964fecdc5f459f04a4a4
refs/heads/master: f9efa9c784aa3b801feb367f72c6867d26fb348e
17 changes: 11 additions & 6 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,16 +1313,13 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
slot = p->slots[level];
BUG_ON(btrfs_header_nritems(b) == 1);
}
unlock_up(p, level, lowest_unlock);

/* this is only true while dropping a snapshot */
if (level == lowest_level) {
unlock_up(p, level, lowest_unlock);
break;
}

if (should_reada)
reada_for_search(root, p, level, slot,
key->objectid);

blocknr = btrfs_node_blockptr(b, slot);
gen = btrfs_node_ptr_generation(b, slot);
blocksize = btrfs_level_size(root, level - 1);
Expand All @@ -1340,6 +1337,11 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_release_path(NULL, p);
if (tmp)
free_extent_buffer(tmp);
if (should_reada)
reada_for_search(root, p,
level, slot,
key->objectid);

tmp = read_tree_block(root, blocknr,
blocksize, gen);
if (tmp)
Expand All @@ -1348,12 +1350,15 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
} else {
if (tmp)
free_extent_buffer(tmp);
if (should_reada)
reada_for_search(root, p,
level, slot,
key->objectid);
b = read_node_slot(root, b, slot);
}
}
if (!p->skip_locking)
btrfs_tree_lock(b);
unlock_up(p, level, lowest_unlock);
} else {
p->slots[level] = slot;
if (ins_len > 0 && btrfs_leaf_free_space(root, b) <
Expand Down
10 changes: 10 additions & 0 deletions trunk/fs/btrfs/locking.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@

int btrfs_tree_lock(struct extent_buffer *eb)
{
int i;

if (!TestSetPageLocked(eb->first_page))
return 0;
for (i = 0; i < 512; i++) {
cpu_relax();
if (!TestSetPageLocked(eb->first_page))
return 0;
}
cpu_relax();
lock_page(eb->first_page);
return 0;
}
Expand Down

0 comments on commit 67169a3

Please sign in to comment.