]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs.c
Update bcachefs sources to ea3414eed5 fixup! bcachefs: Improve diagnostics when journ...
[bcachefs-tools-debian] / libbcachefs.c
index 260e6c7a5bf5e5f5fbd9bf342ba80441359207a0..e7c1ca23224ca721217e4ae14a7ec456c4df9ac3 100644 (file)
@@ -21,6 +21,7 @@
 #include "libbcachefs/btree_cache.h"
 #include "libbcachefs/checksum.h"
 #include "libbcachefs/disk_groups.h"
+#include "libbcachefs/journal_seq_blacklist.h"
 #include "libbcachefs/opts.h"
 #include "libbcachefs/replicas.h"
 #include "libbcachefs/super-io.h"
@@ -618,11 +619,29 @@ static void bch2_sb_print_disk_groups(struct bch_sb *sb, struct bch_sb_field *f,
 static void bch2_sb_print_clean(struct bch_sb *sb, struct bch_sb_field *f,
                                enum units units)
 {
+       struct bch_sb_field_clean *clean = field_to_type(f, clean);
+
+
+       printf("  flags:       %x", le32_to_cpu(clean->flags));
+       printf("  read clock:  %x", le16_to_cpu(clean->read_clock));
+       printf("  write clock: %x", le16_to_cpu(clean->write_clock));
+       printf("  journal seq: %llx", le64_to_cpu(clean->journal_seq));
 }
 
 static void bch2_sb_print_journal_seq_blacklist(struct bch_sb *sb, struct bch_sb_field *f,
                                enum units units)
 {
+       struct bch_sb_field_journal_seq_blacklist *bl = field_to_type(f, journal_seq_blacklist);
+       unsigned i, nr = blacklist_nr_entries(bl);
+
+       for (i = 0; i < nr; i++) {
+               struct journal_seq_blacklist_entry *e =
+                       bl->start + i;
+
+               printf("  %llu-%llu\n",
+                      le64_to_cpu(e->start),
+                      le64_to_cpu(e->end));
+       }
 }
 
 typedef void (*sb_field_print_fn)(struct bch_sb *, struct bch_sb_field *, enum units);
@@ -657,7 +676,7 @@ void bch2_sb_print(struct bch_sb *sb, bool print_layout,
 {
        struct bch_sb_field_members *mi;
        char user_uuid_str[40], internal_uuid_str[40];
-       char features_str[200];
+       char features_str[500];
        char fields_have_str[200];
        char label[BCH_SB_LABEL_SIZE + 1];
        char time_str[64];
@@ -714,6 +733,7 @@ void bch2_sb_print(struct bch_sb *sb, bool print_layout,
 
        printf("External UUID:                  %s\n"
               "Internal UUID:                  %s\n"
+              "Device index:                   %u\n"
               "Label:                          %s\n"
               "Version:                        %llu\n"
               "Created:                        %s\n"
@@ -745,6 +765,7 @@ void bch2_sb_print(struct bch_sb *sb, bool print_layout,
               "Superblock size:                %llu\n",
               user_uuid_str,
               internal_uuid_str,
+              sb->dev_idx,
               label,
               le64_to_cpu(sb->version),
               time_str,
@@ -1040,7 +1061,9 @@ struct bch_opts bch2_parse_opts(struct bch_opt_strs strs)
                ret = bch2_opt_parse(NULL, &bch2_opt_table[i],
                                     strs.by_id[i], &v);
                if (ret < 0)
-                       die("Invalid %s: %s", strs.by_id[i], strerror(-ret));
+                       die("Invalid %s: %s",
+                           bch2_opt_table[i].attr.name,
+                           strerror(-ret));
 
                bch2_opt_set_by_id(&opts, i, v);
        }