summaryrefslogtreecommitdiff
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorZheng Yan <zheng.yan@oracle.com>2008-09-26 10:04:53 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-26 10:04:53 -0400
commite465768938f95388723b0fd3c50a0ae48173edb9 (patch)
tree0f624a9a98dedfafae902e12b384d27e1100cd3a /fs/btrfs/ctree.h
parente8569813849b5da394a195c7e76b4faa452b12d1 (diff)
downloadlwn-e465768938f95388723b0fd3c50a0ae48173edb9.tar.gz
lwn-e465768938f95388723b0fd3c50a0ae48173edb9.zip
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.h19
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;
#define BTRFS_TREE_LOG_OBJECTID -6ULL
#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL
+/* for space balancing */
+#define BTRFS_TREE_RELOC_OBJECTID -8ULL
+#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL
+
/* dummy objectid represents multiple objectids */
#define BTRFS_MULTIPLE_OBJECTIDS -255ULL
@@ -539,6 +543,12 @@ struct btrfs_block_group_cache {
struct list_head list;
};
+struct btrfs_leaf_ref_tree {
+ struct rb_root root;
+ struct list_head list;
+ spinlock_t lock;
+};
+
struct btrfs_device;
struct btrfs_fs_devices;
struct btrfs_fs_info {
@@ -637,6 +647,8 @@ struct btrfs_fs_info {
struct task_struct *cleaner_kthread;
int thread_pool_size;
+ struct btrfs_leaf_ref_tree shared_ref_tree;
+
struct kobject super_kobj;
struct completion kobj_unregister;
int do_barriers;
@@ -670,13 +682,6 @@ struct btrfs_fs_info {
void *bdev_holder;
};
-struct btrfs_leaf_ref_tree {
- struct rb_root root;
- struct btrfs_leaf_ref *last;
- struct list_head list;
- spinlock_t lock;
-};
-
/*
* in ram representation of the tree. extent_root is used for all allocations
* and for the extent tree extent_root root.