diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-08-01 23:11:20 +0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 19:04:06 +0400 |
commit | 65b51a009e29e64c0951f21ea17fdc66bbb0fbd7 (patch) | |
tree | 800926527fad4c12ca64083816f33be3d716ec13 /fs/btrfs/transaction.c | |
parent | 18e35e0ab337ec99c7e03e9ae917745a352c0bb1 (diff) | |
download | linux-65b51a009e29e64c0951f21ea17fdc66bbb0fbd7.tar.xz |
btrfs_search_slot: reduce lock contention by cowing in two stages
A btree block cow has two parts, the first is to allocate a destination
block and the second is to copy the old bock over.
The first part needs locks in the extent allocation tree, and may need to
do IO. This changeset splits that into a separate function that can be
called without any tree locks held.
btrfs_search_slot is changed to drop its path and start over if it has
to COW a contended block. This often means that many writers will
pre-alloc a new destination for a the same contended block, but they
cache their prealloc for later use on lower levels in the tree.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index a68779499302..9d84daf10008 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -622,7 +622,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); old = btrfs_lock_root_node(root); - btrfs_cow_block(trans, root, old, NULL, 0, &old); + btrfs_cow_block(trans, root, old, NULL, 0, &old, 0); btrfs_copy_root(trans, root, old, &tmp, objectid); btrfs_tree_unlock(old); |