Skip to content

Commit 8d65b15

Browse files
author
Kent Overstreet
committed
bcachefs: Fix BCH_SB_ERRS() so we can reorder
BCH_SB_ERRS() has a field for the actual enum val so that we can reorder to reorganize, but the way BCH_SB_ERR_MAX was defined didn't allow for this. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 5612daa commit 8d65b15

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

fs/bcachefs/bcachefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ struct bch_fs {
776776
unsigned nsec_per_time_unit;
777777
u64 features;
778778
u64 compat;
779-
unsigned long errors_silent[BITS_TO_LONGS(BCH_SB_ERR_MAX)];
779+
unsigned long errors_silent[BITS_TO_LONGS(BCH_FSCK_ERR_MAX)];
780780
u64 btrees_lost_data;
781781
} sb;
782782

fs/bcachefs/sb-downgrade.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ static void bch2_sb_downgrade_to_text(struct printbuf *out, struct bch_sb *sb,
312312
if (!first)
313313
prt_char(out, ',');
314314
first = false;
315-
unsigned e = le16_to_cpu(i->errors[j]);
316-
prt_str(out, e < BCH_SB_ERR_MAX ? bch2_sb_error_strs[e] : "(unknown)");
315+
bch2_sb_error_id_to_text(out, le16_to_cpu(i->errors[j]));
317316
}
318317
prt_newline(out);
319318
}
@@ -401,7 +400,7 @@ void bch2_sb_set_downgrade(struct bch_fs *c, unsigned new_minor, unsigned old_mi
401400

402401
for (unsigned j = 0; j < le16_to_cpu(i->nr_errors); j++) {
403402
unsigned e = le16_to_cpu(i->errors[j]);
404-
if (e < BCH_SB_ERR_MAX)
403+
if (e < BCH_FSCK_ERR_MAX)
405404
__set_bit(e, c->sb.errors_silent);
406405
if (e < sizeof(ext->errors_silent) * 8)
407406
__set_bit_le64(e, ext->errors_silent);

fs/bcachefs/sb-errors.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
const char * const bch2_sb_error_strs[] = {
88
#define x(t, n, ...) [n] = #t,
99
BCH_SB_ERRS()
10-
NULL
10+
#undef x
1111
};
1212

13-
static void bch2_sb_error_id_to_text(struct printbuf *out, enum bch_sb_error_id id)
13+
void bch2_sb_error_id_to_text(struct printbuf *out, enum bch_sb_error_id id)
1414
{
15-
if (id < BCH_SB_ERR_MAX)
15+
if (id < BCH_FSCK_ERR_MAX)
1616
prt_str(out, bch2_sb_error_strs[id]);
1717
else
1818
prt_printf(out, "(unknown error %u)", id);

fs/bcachefs/sb-errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
extern const char * const bch2_sb_error_strs[];
88

9+
void bch2_sb_error_id_to_text(struct printbuf *, enum bch_sb_error_id);
10+
911
extern const struct bch_sb_field_ops bch_sb_field_ops_errors;
1012

1113
void bch2_sb_error_count(struct bch_fs *, enum bch_sb_error_id);

fs/bcachefs/sb-errors_format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ enum bch_fsck_flags {
292292
x(accounting_key_replicas_nr_devs_0, 278, FSCK_AUTOFIX) \
293293
x(accounting_key_replicas_nr_required_bad, 279, FSCK_AUTOFIX) \
294294
x(accounting_key_replicas_devs_unsorted, 280, FSCK_AUTOFIX) \
295+
x(MAX, 281, 0)
295296

296297
enum bch_sb_error_id {
297298
#define x(t, n, ...) BCH_FSCK_ERR_##t = n,
298299
BCH_SB_ERRS()
299300
#undef x
300-
BCH_SB_ERR_MAX
301301
};
302302

303303
struct bch_sb_field_errors {

0 commit comments

Comments
 (0)