aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2011-09-13 09:16:43 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2012-01-04 10:12:45 -0500
commitd1270cd91f308c9d22b2804720c36ccd32dbc35e (patch)
tree3dfa3109f7df9983ce88dad5bcb4515f7d4b26b5 /fs/btrfs/extent-tree.c
parent00f04b88791ff49dc64ada18819d40a5b0671709 (diff)
Btrfs: put back delayed refs that are too new
When processing a delayed ref, first check if there are still old refs in the process of being added. If so, put this ref back to the tree. To avoid looping on this ref, choose a newer one in the next loop. btrfs_find_ref_cluster has to take care of that. Signed-off-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index dc8b9a834596..bbcca12fbbba 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2237,6 +2237,28 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
2237 } 2237 }
2238 2238
2239 /* 2239 /*
2240 * locked_ref is the head node, so we have to go one
2241 * node back for any delayed ref updates
2242 */
2243 ref = select_delayed_ref(locked_ref);
2244
2245 if (ref && ref->seq &&
2246 btrfs_check_delayed_seq(delayed_refs, ref->seq)) {
2247 /*
2248 * there are still refs with lower seq numbers in the
2249 * process of being added. Don't run this ref yet.
2250 */
2251 list_del_init(&locked_ref->cluster);
2252 mutex_unlock(&locked_ref->mutex);
2253 locked_ref = NULL;
2254 delayed_refs->num_heads_ready++;
2255 spin_unlock(&delayed_refs->lock);
2256 cond_resched();
2257 spin_lock(&delayed_refs->lock);
2258 continue;
2259 }
2260
2261 /*
2240 * record the must insert reserved flag before we 2262 * record the must insert reserved flag before we
2241 * drop the spin lock. 2263 * drop the spin lock.
2242 */ 2264 */
@@ -2246,11 +2268,6 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
2246 extent_op = locked_ref->extent_op; 2268 extent_op = locked_ref->extent_op;
2247 locked_ref->extent_op = NULL; 2269 locked_ref->extent_op = NULL;
2248 2270
2249 /*
2250 * locked_ref is the head node, so we have to go one
2251 * node back for any delayed ref updates
2252 */
2253 ref = select_delayed_ref(locked_ref);
2254 if (!ref) { 2271 if (!ref) {
2255 /* All delayed refs have been processed, Go ahead 2272 /* All delayed refs have been processed, Go ahead
2256 * and send the head node to run_one_delayed_ref, 2273 * and send the head node to run_one_delayed_ref,