aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-28 15:32:51 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit017e5369eb353559d68a11d4a718faa634533821 (patch)
treec339f2f4a59e403c7f9bfa8d137663c6bf260537 /fs/btrfs/ctree.h
parent31153d81284934601d08110ac7698fd9a535e4c0 (diff)
Btrfs: Leaf reference cache update
This changes the reference cache to make a single cache per root instead of one cache per transaction, and to key by the byte number of the disk block instead of the keys inside. This makes it much less likely to have cache misses if a snapshot or something has an extra reference on a higher node or a leaf while the first transaction that added the leaf into the cache is dropping. Some throttling is added to functions that free blocks heavily so they wait for old transactions to drop. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 34ed23d64eb5..4eca0aa1ce74 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -594,7 +594,6 @@ struct btrfs_fs_info {
594 594
595 spinlock_t ref_cache_lock; 595 spinlock_t ref_cache_lock;
596 u64 total_ref_cache_size; 596 u64 total_ref_cache_size;
597 u64 running_ref_cache_size;
598 597
599 u64 avail_data_alloc_bits; 598 u64 avail_data_alloc_bits;
600 u64 avail_metadata_alloc_bits; 599 u64 avail_metadata_alloc_bits;
@@ -606,10 +605,18 @@ struct btrfs_fs_info {
606 void *bdev_holder; 605 void *bdev_holder;
607}; 606};
608 607
608struct btrfs_leaf_ref_tree {
609 struct rb_root root;
610 struct btrfs_leaf_ref *last;
611 struct list_head list;
612 spinlock_t lock;
613};
614
609/* 615/*
610 * in ram representation of the tree. extent_root is used for all allocations 616 * in ram representation of the tree. extent_root is used for all allocations
611 * and for the extent tree extent_root root. 617 * and for the extent tree extent_root root.
612 */ 618 */
619struct dirty_root;
613struct btrfs_root { 620struct btrfs_root {
614 struct extent_buffer *node; 621 struct extent_buffer *node;
615 622
@@ -618,6 +625,8 @@ struct btrfs_root {
618 625
619 struct extent_buffer *commit_root; 626 struct extent_buffer *commit_root;
620 struct btrfs_leaf_ref_tree *ref_tree; 627 struct btrfs_leaf_ref_tree *ref_tree;
628 struct btrfs_leaf_ref_tree ref_tree_struct;
629 struct dirty_root *dirty_root;
621 630
622 struct btrfs_root_item root_item; 631 struct btrfs_root_item root_item;
623 struct btrfs_key root_key; 632 struct btrfs_key root_key;