aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-08-01 15:11:20 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commit65b51a009e29e64c0951f21ea17fdc66bbb0fbd7 (patch)
tree800926527fad4c12ca64083816f33be3d716ec13 /fs/btrfs/ctree.h
parent18e35e0ab337ec99c7e03e9ae917745a352c0bb1 (diff)
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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d788ab0dcd96..9b025960bbde 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1421,6 +1421,9 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1421 int level, 1421 int level,
1422 u64 hint, 1422 u64 hint,
1423 u64 empty_size); 1423 u64 empty_size);
1424struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
1425 struct btrfs_root *root,
1426 u64 bytenr, u32 blocksize);
1424int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 new_size); 1427int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 new_size);
1425int btrfs_insert_extent_backref(struct btrfs_trans_handle *trans, 1428int btrfs_insert_extent_backref(struct btrfs_trans_handle *trans,
1426 struct btrfs_root *root, 1429 struct btrfs_root *root,
@@ -1451,6 +1454,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
1451 *root, u64 bytenr, u64 num_bytes, 1454 *root, u64 bytenr, u64 num_bytes,
1452 u64 root_objectid, u64 ref_generation, 1455 u64 root_objectid, u64 ref_generation,
1453 u64 owner_objectid, u64 owner_offset, int pin); 1456 u64 owner_objectid, u64 owner_offset, int pin);
1457int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len);
1454int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, 1458int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
1455 struct btrfs_root *root, 1459 struct btrfs_root *root,
1456 struct extent_io_tree *unpin); 1460 struct extent_io_tree *unpin);
@@ -1484,7 +1488,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
1484int btrfs_cow_block(struct btrfs_trans_handle *trans, 1488int btrfs_cow_block(struct btrfs_trans_handle *trans,
1485 struct btrfs_root *root, struct extent_buffer *buf, 1489 struct btrfs_root *root, struct extent_buffer *buf,
1486 struct extent_buffer *parent, int parent_slot, 1490 struct extent_buffer *parent, int parent_slot,
1487 struct extent_buffer **cow_ret); 1491 struct extent_buffer **cow_ret, u64 prealloc_dest);
1488int btrfs_copy_root(struct btrfs_trans_handle *trans, 1492int btrfs_copy_root(struct btrfs_trans_handle *trans,
1489 struct btrfs_root *root, 1493 struct btrfs_root *root,
1490 struct extent_buffer *buf, 1494 struct extent_buffer *buf,