aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/btree.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 7d6204c41840..a3f8ca4ee6e0 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1107,6 +1107,22 @@ static struct btree *btree_node_alloc_replacement(struct btree *b)
1107 return n; 1107 return n;
1108} 1108}
1109 1109
1110static void make_btree_freeing_key(struct btree *b, struct bkey *k)
1111{
1112 unsigned i;
1113
1114 bkey_copy(k, &b->key);
1115 bkey_copy_key(k, &ZERO_KEY);
1116
1117 for (i = 0; i < KEY_PTRS(k); i++) {
1118 uint8_t g = PTR_BUCKET(b->c, k, i)->gen + 1;
1119
1120 SET_PTR_GEN(k, i, g);
1121 }
1122
1123 atomic_inc(&b->c->prio_blocked);
1124}
1125
1110/* Garbage collection */ 1126/* Garbage collection */
1111 1127
1112uint8_t __bch_btree_mark_key(struct cache_set *c, int level, struct bkey *k) 1128uint8_t __bch_btree_mark_key(struct cache_set *c, int level, struct bkey *k)
@@ -2030,20 +2046,9 @@ static int btree_split(struct btree *b, struct btree_op *op,
2030 closure_sync(&cl); 2046 closure_sync(&cl);
2031 bch_btree_set_root(n1); 2047 bch_btree_set_root(n1);
2032 } else { 2048 } else {
2033 unsigned i;
2034
2035 bkey_copy(parent_keys->top, &b->key);
2036 bkey_copy_key(parent_keys->top, &ZERO_KEY);
2037
2038 for (i = 0; i < KEY_PTRS(&b->key); i++) {
2039 uint8_t g = PTR_BUCKET(b->c, &b->key, i)->gen + 1;
2040
2041 SET_PTR_GEN(parent_keys->top, i, g);
2042 }
2043
2044 bch_keylist_push(parent_keys);
2045 closure_sync(&cl); 2049 closure_sync(&cl);
2046 atomic_inc(&b->c->prio_blocked); 2050 make_btree_freeing_key(b, parent_keys->top);
2051 bch_keylist_push(parent_keys);
2047 } 2052 }
2048 2053
2049 rw_unlock(true, n1); 2054 rw_unlock(true, n1);