bool __bch_btree_ptr_invalid(struct cache_set *c, const struct bkey *k) { char buf[80]; if (!KEY_PTRS(k) || !KEY_SIZE(k) || KEY_DIRTY(k)) goto bad; if (__ptr_invalid(c, k)) goto bad; return false; bad: bch_extent_to_text(buf, sizeof(buf), k); cache_bug(c, "spotted btree ptr %s: %s", buf, bch_ptr_status(c, k)); return true; }
bool __bch_extent_invalid(struct cache_set *c, const struct bkey *k) { char buf[80]; if (!KEY_SIZE(k)) return true; if (KEY_SIZE(k) > KEY_OFFSET(k)) goto bad; if (__ptr_invalid(c, k)) goto bad; return false; bad: bch_extent_to_text(buf, sizeof(buf), k); cache_bug(c, "spotted extent %s: %s", buf, bch_ptr_status(c, k)); return true; }
static bool bch_extent_invalid(struct btree_keys *bk, const struct bkey *k) { struct btree *b = container_of(bk, struct btree, keys); char buf[80]; if (!KEY_SIZE(k)) return true; if (KEY_SIZE(k) > KEY_OFFSET(k)) goto bad; if (__ptr_invalid(b->c, k)) goto bad; return false; bad: bch_extent_to_text(buf, sizeof(buf), k); cache_bug(b->c, "spotted extent %s: %s", buf, bch_ptr_status(b->c, k)); return true; }