]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Btrfs: don't use spin_is_contended
authorChris Mason <chris.mason@oracle.com>
Mon, 9 Feb 2009 21:22:03 +0000 (16:22 -0500)
committerChris Mason <chris.mason@oracle.com>
Mon, 9 Feb 2009 21:22:03 +0000 (16:22 -0500)
Btrfs was using spin_is_contended to see if it should drop locks before
doing extent allocations during btrfs_search_slot.  The idea was to avoid
expensive searches in the tree unless the lock was actually contended.

But, spin_is_contended is specific to the ticket spinlocks on x86, so this
is causing compile errors everywhere else.

In practice, the contention could easily appear some time after we started
doing the extent allocation, and it makes more sense to always drop the lock
instead.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c
fs/btrfs/locking.c
fs/btrfs/locking.h

index 551177c0011ae90d3e2c0460340071ea97158b50..35443cc4b9a976607f41866d68c202855c1bf16b 100644 (file)
@@ -1530,8 +1530,7 @@ again:
                         * for higher level blocks, try not to allocate blocks
                         * with the block and the parent locks held.
                         */
-                       if (level > 0 && !prealloc_block.objectid &&
-                           btrfs_path_lock_waiting(p, level)) {
+                       if (level > 0 && !prealloc_block.objectid) {
                                u32 size = b->len;
                                u64 hint = b->start;
 
index 68fd9ccf1805e63adf0973612f9822b9585034f8..9ebe9385129be7a32c3394a9d20ab13ff119fcb9 100644 (file)
@@ -236,25 +236,3 @@ int btrfs_tree_locked(struct extent_buffer *eb)
        return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) ||
                        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;
-}
-
index d92e707f5870c1dfb13462298047b58c8827f622..6bb0afbff9287d4e841748f02d60eae488d7de7c 100644 (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_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_clear_lock_blocking(struct extent_buffer *eb);
 #endif