aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-ref.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/delayed-ref.h')
-rw-r--r--fs/btrfs/delayed-ref.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index 70b962cc177d..4ba9b93022ff 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -81,7 +81,10 @@ struct btrfs_delayed_ref_head {
81 */ 81 */
82 struct mutex mutex; 82 struct mutex mutex;
83 83
84 struct list_head cluster; 84 spinlock_t lock;
85 struct rb_root ref_root;
86
87 struct rb_node href_node;
85 88
86 struct btrfs_delayed_extent_op *extent_op; 89 struct btrfs_delayed_extent_op *extent_op;
87 /* 90 /*
@@ -98,6 +101,7 @@ struct btrfs_delayed_ref_head {
98 */ 101 */
99 unsigned int must_insert_reserved:1; 102 unsigned int must_insert_reserved:1;
100 unsigned int is_data:1; 103 unsigned int is_data:1;
104 unsigned int processing:1;
101}; 105};
102 106
103struct btrfs_delayed_tree_ref { 107struct btrfs_delayed_tree_ref {
@@ -116,7 +120,8 @@ struct btrfs_delayed_data_ref {
116}; 120};
117 121
118struct btrfs_delayed_ref_root { 122struct btrfs_delayed_ref_root {
119 struct rb_root root; 123 /* head ref rbtree */
124 struct rb_root href_root;
120 125
121 /* this spin lock protects the rbtree and the entries inside */ 126 /* this spin lock protects the rbtree and the entries inside */
122 spinlock_t lock; 127 spinlock_t lock;
@@ -124,7 +129,7 @@ struct btrfs_delayed_ref_root {
124 /* how many delayed ref updates we've queued, used by the 129 /* how many delayed ref updates we've queued, used by the
125 * throttling code 130 * throttling code
126 */ 131 */
127 unsigned long num_entries; 132 atomic_t num_entries;
128 133
129 /* total number of head nodes in tree */ 134 /* total number of head nodes in tree */
130 unsigned long num_heads; 135 unsigned long num_heads;
@@ -133,15 +138,6 @@ struct btrfs_delayed_ref_root {
133 unsigned long num_heads_ready; 138 unsigned long num_heads_ready;
134 139
135 /* 140 /*
136 * bumped when someone is making progress on the delayed
137 * refs, so that other procs know they are just adding to
138 * contention intead of helping
139 */
140 atomic_t procs_running_refs;
141 atomic_t ref_seq;
142 wait_queue_head_t wait;
143
144 /*
145 * set when the tree is flushing before a transaction commit, 141 * set when the tree is flushing before a transaction commit,
146 * used by the throttling code to decide if new updates need 142 * used by the throttling code to decide if new updates need
147 * to be run right away 143 * to be run right away
@@ -226,9 +222,9 @@ static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head)
226 mutex_unlock(&head->mutex); 222 mutex_unlock(&head->mutex);
227} 223}
228 224
229int btrfs_find_ref_cluster(struct btrfs_trans_handle *trans, 225
230 struct list_head *cluster, u64 search_start); 226struct btrfs_delayed_ref_head *
231void btrfs_release_ref_cluster(struct list_head *cluster); 227btrfs_select_ref_head(struct btrfs_trans_handle *trans);
232 228
233int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info, 229int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info,
234 struct btrfs_delayed_ref_root *delayed_refs, 230 struct btrfs_delayed_ref_root *delayed_refs,