summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2015-05-28 19:23:09 -0700
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 20:57:10 -0900
commitce4a65132a9cbc77ac6da457d7758a4f8b89e3d6 (patch)
treec88cf777d6b1ef01670c0b925d2a269fad29c9ab
parent3759e8982de153c493d9a18db4b3212e253de3ac (diff)
bcache: bch_bkey_val_to_text() now takes bkey type
-rw-r--r--drivers/md/bcache/bkey_methods.c5
-rw-r--r--drivers/md/bcache/bkey_methods.h2
-rw-r--r--drivers/md/bcache/btree.c3
-rw-r--r--drivers/md/bcache/debug.c6
-rw-r--r--drivers/md/bcache/extents.c15
5 files changed, 17 insertions, 14 deletions
diff --git a/drivers/md/bcache/bkey_methods.c b/drivers/md/bcache/bkey_methods.c
index 03affccac1ce..fc0ca2631921 100644
--- a/drivers/md/bcache/bkey_methods.c
+++ b/drivers/md/bcache/bkey_methods.c
@@ -65,7 +65,7 @@ void bkey_debugcheck(struct cache_set *c, struct btree *b, struct bkey_s_c k)
if (bkey_invalid(c, type, k)) {
char buf[160];
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, type, buf, sizeof(buf), k);
cache_set_bug(c, "invalid bkey %s", buf);
return;
}
@@ -75,10 +75,9 @@ void bkey_debugcheck(struct cache_set *c, struct btree *b, struct bkey_s_c k)
ops->key_debugcheck(c, b, k);
}
-void bch_bkey_val_to_text(struct cache_set *c, struct btree *b,
+void bch_bkey_val_to_text(struct cache_set *c, enum bkey_type type,
char *buf, size_t size, struct bkey_s_c k)
{
- enum bkey_type type = btree_node_type(b);
const struct bkey_ops *ops = bch_bkey_ops[type];
char *out = buf, *end = buf + size;
diff --git a/drivers/md/bcache/bkey_methods.h b/drivers/md/bcache/bkey_methods.h
index b0d422752a70..a8a5e802160e 100644
--- a/drivers/md/bcache/bkey_methods.h
+++ b/drivers/md/bcache/bkey_methods.h
@@ -27,7 +27,7 @@ struct bkey_ops {
bool bkey_invalid(struct cache_set *, enum bkey_type, struct bkey_s_c);
void bkey_debugcheck(struct cache_set *, struct btree *, struct bkey_s_c);
-void bch_bkey_val_to_text(struct cache_set *, struct btree *,
+void bch_bkey_val_to_text(struct cache_set *, enum bkey_type,
char *, size_t, struct bkey_s_c);
#undef DEF_BTREE_ID
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 8db2f8c62e3a..cebf04cbe7e7 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -399,7 +399,8 @@ static const char *validate_bset(struct cache_set *c, struct btree *b,
char buf[160];
bkey_disassemble(&tup, f, k);
- bch_bkey_val_to_text(c, b, buf, sizeof(buf),
+ bch_bkey_val_to_text(c, btree_node_type(b),
+ buf, sizeof(buf),
bkey_tup_to_s_c(&tup));
btree_node_error(b, ca, ptr,
"invalid bkey %s", buf);
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 002e8e69c10a..3ab43c9fd87d 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -196,7 +196,7 @@ void bch_verify_inode_refs(struct cache_set *c)
if (k.k->p.inode != cur_inum &&
bch_inode_find_by_inum(c, k.k->p.inode, &inode)) {
- bch_bkey_val_to_text(c, iter.nodes[0], buf,
+ bch_bkey_val_to_text(c, BTREE_ID_EXTENTS, buf,
sizeof(buf), k);
bch_cache_set_error(c,
"extent for missing inode %llu\n%s",
@@ -216,7 +216,7 @@ void bch_verify_inode_refs(struct cache_set *c)
BUG_ON(inode.v.i_flags & BCH_INODE_I_SIZE_DIRTY);
if (k.k->p.offset > round_up(inode.v.i_size, PAGE_SIZE) >> 9) {
- bch_bkey_val_to_text(c, iter.nodes[0], buf,
+ bch_bkey_val_to_text(c, BTREE_ID_EXTENTS, buf,
sizeof(buf), k);
bch_cache_set_error(c,
"extent past end of inode %llu: i_size %llu extent\n%s",
@@ -353,7 +353,7 @@ static ssize_t bch_read_btree(struct file *file, char __user *buf,
bch_btree_iter_init(&iter, i->c, i->id, i->from);
while ((k = bch_btree_iter_peek(&iter)).k) {
- bch_bkey_val_to_text(i->c, iter.nodes[0], i->buf,
+ bch_bkey_val_to_text(i->c, i->id, i->buf,
sizeof(i->buf), k);
i->bytes = strlen(i->buf);
BUG_ON(i->bytes >= PAGE_SIZE);
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 2d5cf1fae0d6..4922b480260f 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -377,7 +377,8 @@ static void btree_ptr_debugcheck(struct cache_set *c, struct btree *b,
}
if (bch_extent_ptrs(e) < CACHE_SET_META_REPLICAS_HAVE(&c->sb)) {
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b),
+ buf, sizeof(buf), k);
cache_set_bug(c,
"btree key bad (too few replicas, %u < %llu): %s",
bch_extent_ptrs(e),
@@ -410,7 +411,7 @@ static void btree_ptr_debugcheck(struct cache_set *c, struct btree *b,
return;
err:
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b), buf, sizeof(buf), k);
btree_bug(b, "%s btree pointer %s: bucket %zi prio %i "
"gen %i last_gc %i mark %08x",
err, buf, PTR_BUCKET_NR(ca, ptr),
@@ -1285,7 +1286,8 @@ static void bch_extent_debugcheck(struct cache_set *c, struct btree *b,
if (!EXTENT_CACHED(e.v) &&
bch_extent_ptrs(e) < CACHE_SET_DATA_REPLICAS_HAVE(&c->sb)) {
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b),
+ buf, sizeof(buf), k);
cache_set_bug(c,
"extent key bad (too few replicas, %u < %llu): %s",
bch_extent_ptrs(e),
@@ -1354,7 +1356,8 @@ static void bch_extent_debugcheck(struct cache_set *c, struct btree *b,
replicas = CACHE_SET_DATA_REPLICAS_WANT(&c->sb);
for (i = 0; i < CACHE_TIERS; i++)
if (ptrs_per_tier[i] > replicas) {
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b),
+ buf, sizeof(buf), k);
cache_set_bug(c,
"extent key bad (too many tier %u replicas): %s",
i, buf);
@@ -1365,14 +1368,14 @@ static void bch_extent_debugcheck(struct cache_set *c, struct btree *b,
return;
bad_device:
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b), buf, sizeof(buf), k);
cache_set_bug(c, "extent pointer %u device missing: %s",
(unsigned) (ptr - e.v->ptr), buf);
cache_member_info_put();
return;
bad_ptr:
- bch_bkey_val_to_text(c, b, buf, sizeof(buf), k);
+ bch_bkey_val_to_text(c, btree_node_type(b), buf, sizeof(buf), k);
cache_set_bug(c, "extent pointer %u bad gc mark: %s:\nbucket %zu prio %i "
"gen %i last_gc %i mark 0x%08x",
(unsigned) (ptr - e.v->ptr), buf, PTR_BUCKET_NR(ca, ptr),