summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorHongbo Li <lihongbo22@huawei.com>2024-07-12 10:09:25 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-15 02:00:16 +0300
commit114f530e1e600245b0f9c114aa75c1ecc4376c67 (patch)
treec03a3072c906934f2acfc56b2732513d12f1ac9c /fs
parent7b6dda7282b1f26094aac21e1862690c79152e51 (diff)
downloadlinux-114f530e1e600245b0f9c114aa75c1ecc4376c67.tar.xz
bcachefs: show none if label is not set
If label is not set, the Label tag in superblock info show '(none)'. ``` [Before] Device index: 0 Label: Version: 1.4: member_seq [After] Device index: 0 Label: (none) Version: 1.4: member_seq ``` Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/super-io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index b156fc85b8a3..8bc819832790 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -1312,7 +1312,10 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb,
prt_printf(out, "Device index:\t%u\n", sb->dev_idx);
prt_printf(out, "Label:\t");
- prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label);
+ if (!strlen(sb->label))
+ prt_printf(out, "(none)");
+ else
+ prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label);
prt_newline(out);
prt_printf(out, "Version:\t");