diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-12 16:56:43 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-12 16:56:43 -0500 |
commit | e7c4380a892297d2f65e1c317a1b6d4c67378299 (patch) | |
tree | 5663bfdcc1c2d67f6b1a8a9da517941cdf44888e /libbcachefs/btree_cache.c | |
parent | fb2d506f6f5c582d89596a2d2d1b2cc7d8374a7a (diff) |
Update bcachefs sources to 63924135a1 bcachefs: Have fsck check for stripe pointers matching stripe
Diffstat (limited to 'libbcachefs/btree_cache.c')
-rw-r--r-- | libbcachefs/btree_cache.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libbcachefs/btree_cache.c b/libbcachefs/btree_cache.c index b8e183b7..89b3b509 100644 --- a/libbcachefs/btree_cache.c +++ b/libbcachefs/btree_cache.c @@ -836,7 +836,7 @@ retry: b = btree_cache_find(bc, k); if (unlikely(!b)) { if (nofill) - return NULL; + goto out; b = bch2_btree_node_fill(c, NULL, k, btree_id, level, SIX_LOCK_read, true); @@ -845,8 +845,12 @@ retry: if (!b) goto retry; + if (IS_ERR(b) && + !bch2_btree_cache_cannibalize_lock(c, NULL)) + goto retry; + if (IS_ERR(b)) - return b; + goto out; } else { lock_node: ret = six_lock_read(&b->c.lock, lock_node_check_fn, (void *) k); @@ -881,7 +885,8 @@ lock_node: if (unlikely(btree_node_read_error(b))) { six_unlock_read(&b->c.lock); - return ERR_PTR(-EIO); + b = ERR_PTR(-EIO); + goto out; } EBUG_ON(b->c.btree_id != btree_id); @@ -890,7 +895,8 @@ lock_node: EBUG_ON(b->key.k.type == KEY_TYPE_btree_ptr_v2 && bkey_cmp(b->data->min_key, bkey_i_to_btree_ptr_v2(&b->key)->v.min_key)); - +out: + bch2_btree_cache_cannibalize_unlock(c); return b; } @@ -1051,15 +1057,14 @@ void bch2_btree_node_to_text(struct printbuf *out, struct bch_fs *c, bch2_btree_keys_stats(b, &stats); - pr_buf(out, - "l %u %llu:%llu - %llu:%llu:\n" - " ptrs: ", - b->c.level, - b->data->min_key.inode, - b->data->min_key.offset, - b->data->max_key.inode, - b->data->max_key.offset); + pr_buf(out, "l %u ", b->c.level); + bch2_bpos_to_text(out, b->data->min_key); + pr_buf(out, " - "); + bch2_bpos_to_text(out, b->data->max_key); + pr_buf(out, ":\n" + " ptrs: "); bch2_val_to_text(out, c, bkey_i_to_s_c(&b->key)); + pr_buf(out, "\n" " format: u64s %u fields %u %u %u %u %u\n" " unpack fn len: %u\n" |