summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-04 05:01:40 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:33 +0300
commit401ec4db630802729f10d53ad995083ced98caca (patch)
tree245f07e5928f1414b6da71f14c417829e763fdde /fs/bcachefs/super.c
parent652018d66190412669a898c2dc3e75073eac8679 (diff)
downloadlinux-401ec4db630802729f10d53ad995083ced98caca.tar.xz
bcachefs: Printbuf rework
This converts bcachefs to the modern printbuf interface/implementation, synced with the version to be submitted upstream. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 8d02a8158520..cc887a1b8c8f 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -605,6 +605,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
{
struct bch_sb_field_members *mi;
struct bch_fs *c;
+ struct printbuf name = PRINTBUF;
unsigned i, iter_size;
int ret = 0;
@@ -708,7 +709,13 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
if (ret)
goto err;
- uuid_unparse_lower(c->sb.user_uuid.b, c->name);
+ pr_uuid(&name, c->sb.user_uuid.b);
+ strlcpy(c->name, name.buf, sizeof(c->name));
+ printbuf_exit(&name);
+
+ ret = name.allocation_failure ? -ENOMEM : 0;
+ if (ret)
+ goto err;
/* Compat: */
if (sb->version <= bcachefs_metadata_version_inode_v2 &&
@@ -830,7 +837,7 @@ static void print_mount_opts(struct bch_fs *c)
bool first = true;
if (c->opts.read_only) {
- pr_buf(&p, "ro");
+ prt_printf(&p, "ro");
first = false;
}
@@ -845,13 +852,13 @@ static void print_mount_opts(struct bch_fs *c)
continue;
if (!first)
- pr_buf(&p, ",");
+ prt_printf(&p, ",");
first = false;
bch2_opt_to_text(&p, c, c->disk_sb.sb, opt, v, OPT_SHOW_MOUNT_STYLE);
}
if (!p.pos)
- pr_buf(&p, "(null)");
+ prt_printf(&p, "(null)");
bch_info(c, "mounted version=%s opts=%s", bch2_metadata_versions[c->sb.version], p.buf);
printbuf_exit(&p);
@@ -1482,7 +1489,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
if (data) {
struct printbuf data_has = PRINTBUF;
- bch2_flags_to_text(&data_has, bch2_data_types, data);
+ prt_bitflags(&data_has, bch2_data_types, data);
bch_err(ca, "Remove failed, still has data (%s)", data_has.buf);
printbuf_exit(&data_has);
ret = -EBUSY;