Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: don't use spin_is_contended
This commit is contained in:
Linus Torvalds 2009-02-09 14:00:16 -08:00
commit 4c098bcd55
3 changed files with 1 additions and 26 deletions

View file

@ -1530,8 +1530,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
* for higher level blocks, try not to allocate blocks * for higher level blocks, try not to allocate blocks
* with the block and the parent locks held. * with the block and the parent locks held.
*/ */
if (level > 0 && !prealloc_block.objectid && if (level > 0 && !prealloc_block.objectid) {
btrfs_path_lock_waiting(p, level)) {
u32 size = b->len; u32 size = b->len;
u64 hint = b->start; u64 hint = b->start;

View file

@ -236,25 +236,3 @@ int btrfs_tree_locked(struct extent_buffer *eb)
return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) || return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) ||
spin_is_locked(&eb->lock); spin_is_locked(&eb->lock);
} }
/*
* btrfs_search_slot uses this to decide if it should drop its locks
* before doing something expensive like allocating free blocks for cow.
*/
int btrfs_path_lock_waiting(struct btrfs_path *path, int level)
{
int i;
struct extent_buffer *eb;
for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) {
eb = path->nodes[i];
if (!eb)
break;
smp_mb();
if (spin_is_contended(&eb->lock) ||
waitqueue_active(&eb->lock_wq))
return 1;
}
return 0;
}

View file

@ -26,8 +26,6 @@ int btrfs_tree_locked(struct extent_buffer *eb);
int btrfs_try_tree_lock(struct extent_buffer *eb); int btrfs_try_tree_lock(struct extent_buffer *eb);
int btrfs_try_spin_lock(struct extent_buffer *eb); int btrfs_try_spin_lock(struct extent_buffer *eb);
int btrfs_path_lock_waiting(struct btrfs_path *path, int level);
void btrfs_set_lock_blocking(struct extent_buffer *eb); void btrfs_set_lock_blocking(struct extent_buffer *eb);
void btrfs_clear_lock_blocking(struct extent_buffer *eb); void btrfs_clear_lock_blocking(struct extent_buffer *eb);
#endif #endif