]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: show none if label is not set
authorHongbo Li <lihongbo22@huawei.com>
Fri, 12 Jul 2024 07:09:25 +0000 (15:09 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:16 +0000 (19:00 -0400)
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>
fs/bcachefs/super-io.c

index b156fc85b8a3eb9b93283ec9187412f503ca9183..8bc8198327904454da03e34a9da8931d7f92d5f0 100644 (file)
@@ -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");