Commit 3f305e04 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Improve bch2_dirent_to_text()

For DT_SUBVOL, we now print both parent and child subvol IDs.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 7b05ecba
...@@ -144,19 +144,21 @@ int bch2_dirent_invalid(struct bch_fs *c, struct bkey_s_c k, ...@@ -144,19 +144,21 @@ int bch2_dirent_invalid(struct bch_fs *c, struct bkey_s_c k,
return ret; return ret;
} }
void bch2_dirent_to_text(struct printbuf *out, struct bch_fs *c, void bch2_dirent_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c k)
struct bkey_s_c k)
{ {
struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k); struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k);
struct qstr d_name = bch2_dirent_get_name(d); struct qstr d_name = bch2_dirent_get_name(d);
prt_printf(out, "%.*s -> %llu type %s", prt_printf(out, "%.*s -> ", d_name.len, d_name.name);
d_name.len,
d_name.name, if (d.v->d_type != DT_SUBVOL)
d.v->d_type != DT_SUBVOL prt_printf(out, "%llu", le64_to_cpu(d.v->d_inum));
? le64_to_cpu(d.v->d_inum) else
: le32_to_cpu(d.v->d_child_subvol), prt_printf(out, "%u -> %u",
bch2_d_type_str(d.v->d_type)); le32_to_cpu(d.v->d_parent_subvol),
le32_to_cpu(d.v->d_child_subvol));
prt_printf(out, " type %s", bch2_d_type_str(d.v->d_type));
} }
static struct bkey_i_dirent *dirent_create_key(struct btree_trans *trans, static struct bkey_i_dirent *dirent_create_key(struct btree_trans *trans,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment