diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-28 19:53:05 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:05 -0400 |
commit | e3804b55e4358cf5a235fa1ba32204af9f7046dd (patch) | |
tree | b1946b7b645d8de6409aa6f7dfda63fcfd7e6f34 /fs/bcachefs/recovery.c | |
parent | f33c58fc46a9c5bd6cbf90edb6ce17fa3fd912d5 (diff) |
bcachefs: bch2_version_to_text()
Add a new helper for printing out metadata versions in a standard
format.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r-- | fs/bcachefs/recovery.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 16a99edb2ea8..b86442c7c912 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -1146,17 +1146,22 @@ int bch2_fs_recovery(struct bch_fs *c) goto err; } - if (!c->opts.nochanges) { - if (c->sb.version < bcachefs_metadata_required_upgrade_below) { - bch_info(c, "version %s (%u) prior to %s (%u), upgrade and fsck required", - bch2_metadata_versions[c->sb.version], - c->sb.version, - bch2_metadata_versions[bcachefs_metadata_required_upgrade_below], - bcachefs_metadata_required_upgrade_below); - c->opts.version_upgrade = true; - c->opts.fsck = true; - c->opts.fix_errors = FSCK_OPT_YES; - } + if (!c->opts.nochanges && + c->sb.version < bcachefs_metadata_required_upgrade_below) { + struct printbuf buf = PRINTBUF; + + prt_str(&buf, "version "); + bch2_version_to_text(&buf, c->sb.version); + prt_str(&buf, " prior to "); + bch2_version_to_text(&buf, bcachefs_metadata_required_upgrade_below); + prt_str(&buf, ", upgrade and fsck required"); + + bch_info(c, "%s", buf.buf); + printbuf_exit(&buf); + + c->opts.version_upgrade = true; + c->opts.fsck = true; + c->opts.fix_errors = FSCK_OPT_YES; } if (c->opts.fsck && c->opts.norecovery) { |