diff options
author | Zheng Yan <zheng.yan@oracle.com> | 2008-09-26 10:04:53 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-26 10:04:53 -0400 |
commit | e465768938f95388723b0fd3c50a0ae48173edb9 (patch) | |
tree | 0f624a9a98dedfafae902e12b384d27e1100cd3a /fs/btrfs/ctree.h | |
parent | e8569813849b5da394a195c7e76b4faa452b12d1 (diff) |
Btrfs: Add shared reference cache
Btrfs has a cache of reference counts in leaves, allowing it to
avoid reading tree leaves while deleting snapshots. To reduce
contention with multiple subvolumes, this cache is private to each
subvolume.
This patch adds shared reference cache support. The new space
balancing code plays with multiple subvols at the same time, So
the old per-subvol reference cache is not well suited.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c683aaa925fa..b9f9f815ed09 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -81,6 +81,10 @@ struct btrfs_ordered_sum; | |||
81 | #define BTRFS_TREE_LOG_OBJECTID -6ULL | 81 | #define BTRFS_TREE_LOG_OBJECTID -6ULL |
82 | #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL | 82 | #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL |
83 | 83 | ||
84 | /* for space balancing */ | ||
85 | #define BTRFS_TREE_RELOC_OBJECTID -8ULL | ||
86 | #define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL | ||
87 | |||
84 | /* dummy objectid represents multiple objectids */ | 88 | /* dummy objectid represents multiple objectids */ |
85 | #define BTRFS_MULTIPLE_OBJECTIDS -255ULL | 89 | #define BTRFS_MULTIPLE_OBJECTIDS -255ULL |
86 | 90 | ||
@@ -539,6 +543,12 @@ struct btrfs_block_group_cache { | |||
539 | struct list_head list; | 543 | struct list_head list; |
540 | }; | 544 | }; |
541 | 545 | ||
546 | struct btrfs_leaf_ref_tree { | ||
547 | struct rb_root root; | ||
548 | struct list_head list; | ||
549 | spinlock_t lock; | ||
550 | }; | ||
551 | |||
542 | struct btrfs_device; | 552 | struct btrfs_device; |
543 | struct btrfs_fs_devices; | 553 | struct btrfs_fs_devices; |
544 | struct btrfs_fs_info { | 554 | struct btrfs_fs_info { |
@@ -637,6 +647,8 @@ struct btrfs_fs_info { | |||
637 | struct task_struct *cleaner_kthread; | 647 | struct task_struct *cleaner_kthread; |
638 | int thread_pool_size; | 648 | int thread_pool_size; |
639 | 649 | ||
650 | struct btrfs_leaf_ref_tree shared_ref_tree; | ||
651 | |||
640 | struct kobject super_kobj; | 652 | struct kobject super_kobj; |
641 | struct completion kobj_unregister; | 653 | struct completion kobj_unregister; |
642 | int do_barriers; | 654 | int do_barriers; |
@@ -670,13 +682,6 @@ struct btrfs_fs_info { | |||
670 | void *bdev_holder; | 682 | void *bdev_holder; |
671 | }; | 683 | }; |
672 | 684 | ||
673 | struct btrfs_leaf_ref_tree { | ||
674 | struct rb_root root; | ||
675 | struct btrfs_leaf_ref *last; | ||
676 | struct list_head list; | ||
677 | spinlock_t lock; | ||
678 | }; | ||
679 | |||
680 | /* | 685 | /* |
681 | * in ram representation of the tree. extent_root is used for all allocations | 686 | * in ram representation of the tree. extent_root is used for all allocations |
682 | * and for the extent tree extent_root root. | 687 | * and for the extent tree extent_root root. |