@@ -57,8 +57,6 @@ int bch2_btree_node_check_topology(struct btree_trans *trans, struct btree *b)
57
57
struct bkey_buf prev ;
58
58
int ret = 0 ;
59
59
60
- printbuf_indent_add_nextline (& buf , 2 );
61
-
62
60
BUG_ON (b -> key .k .type == KEY_TYPE_btree_ptr_v2 &&
63
61
!bpos_eq (bkey_i_to_btree_ptr_v2 (& b -> key )-> v .min_key ,
64
62
b -> data -> min_key ));
@@ -69,20 +67,23 @@ int bch2_btree_node_check_topology(struct btree_trans *trans, struct btree *b)
69
67
70
68
if (b == btree_node_root (c , b )) {
71
69
if (!bpos_eq (b -> data -> min_key , POS_MIN )) {
72
- ret = __bch2_topology_error (c , & buf );
73
-
70
+ bch2_log_msg_start (c , & buf );
71
+ prt_printf ( & buf , "btree root with incorrect min_key: " );
74
72
bch2_bpos_to_text (& buf , b -> data -> min_key );
75
- log_fsck_err (trans , btree_root_bad_min_key ,
76
- "btree root with incorrect min_key: %s" , buf .buf );
77
- goto out ;
73
+ prt_newline (& buf );
74
+
75
+ bch2_count_fsck_err (c , btree_root_bad_min_key , & buf );
76
+ goto err ;
78
77
}
79
78
80
79
if (!bpos_eq (b -> data -> max_key , SPOS_MAX )) {
81
- ret = __bch2_topology_error (c , & buf );
80
+ bch2_log_msg_start (c , & buf );
81
+ prt_printf (& buf , "btree root with incorrect max_key: " );
82
82
bch2_bpos_to_text (& buf , b -> data -> max_key );
83
- log_fsck_err (trans , btree_root_bad_max_key ,
84
- "btree root with incorrect max_key: %s" , buf .buf );
85
- goto out ;
83
+ prt_newline (& buf );
84
+
85
+ bch2_count_fsck_err (c , btree_root_bad_max_key , & buf );
86
+ goto err ;
86
87
}
87
88
}
88
89
@@ -100,52 +101,50 @@ int bch2_btree_node_check_topology(struct btree_trans *trans, struct btree *b)
100
101
: bpos_successor (prev .k -> k .p );
101
102
102
103
if (!bpos_eq (expected_min , bp .v -> min_key )) {
103
- ret = __bch2_topology_error (c , & buf );
104
-
105
- prt_str (& buf , "end of prev node doesn't match start of next node\nin " );
106
- bch2_btree_id_level_to_text (& buf , b -> c .btree_id , b -> c .level );
107
- prt_str (& buf , " node " );
108
- bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (& b -> key ));
104
+ prt_str (& buf , "end of prev node doesn't match start of next node" );
109
105
prt_str (& buf , "\nprev " );
110
106
bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (prev .k ));
111
107
prt_str (& buf , "\nnext " );
112
108
bch2_bkey_val_to_text (& buf , c , k );
109
+ prt_newline (& buf );
113
110
114
- log_fsck_err ( trans , btree_node_topology_bad_min_key , "%s" , buf . buf );
115
- goto out ;
111
+ bch2_count_fsck_err ( c , btree_node_topology_bad_min_key , & buf );
112
+ goto err ;
116
113
}
117
114
118
115
bch2_bkey_buf_reassemble (& prev , c , k );
119
116
bch2_btree_and_journal_iter_advance (& iter );
120
117
}
121
118
122
119
if (bkey_deleted (& prev .k -> k )) {
123
- ret = __bch2_topology_error (c , & buf );
124
-
125
- prt_str (& buf , "empty interior node\nin " );
126
- bch2_btree_id_level_to_text (& buf , b -> c .btree_id , b -> c .level );
127
- prt_str (& buf , " node " );
128
- bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (& b -> key ));
129
-
130
- log_fsck_err (trans , btree_node_topology_empty_interior_node , "%s" , buf .buf );
131
- } else if (!bpos_eq (prev .k -> k .p , b -> key .k .p )) {
132
- ret = __bch2_topology_error (c , & buf );
120
+ prt_printf (& buf , "empty interior node\n" );
121
+ bch2_count_fsck_err (c , btree_node_topology_empty_interior_node , & buf );
122
+ goto err ;
123
+ }
133
124
134
- prt_str (& buf , "last child node doesn't end at end of parent node\nin " );
135
- bch2_btree_id_level_to_text (& buf , b -> c .btree_id , b -> c .level );
136
- prt_str (& buf , " node " );
137
- bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (& b -> key ));
138
- prt_str (& buf , "\nlast key " );
125
+ if (!bpos_eq (prev .k -> k .p , b -> key .k .p )) {
126
+ prt_str (& buf , "last child node doesn't end at end of parent node\nchild: " );
139
127
bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (prev .k ));
128
+ prt_newline (& buf );
140
129
141
- log_fsck_err (trans , btree_node_topology_bad_max_key , "%s" , buf .buf );
130
+ bch2_count_fsck_err (c , btree_node_topology_bad_max_key , & buf );
131
+ goto err ;
142
132
}
143
133
out :
144
- fsck_err :
145
134
bch2_btree_and_journal_iter_exit (& iter );
146
135
bch2_bkey_buf_exit (& prev , c );
147
136
printbuf_exit (& buf );
148
137
return ret ;
138
+ err :
139
+ bch2_btree_id_level_to_text (& buf , b -> c .btree_id , b -> c .level );
140
+ prt_char (& buf , ' ' );
141
+ bch2_bkey_val_to_text (& buf , c , bkey_i_to_s_c (& b -> key ));
142
+ prt_newline (& buf );
143
+
144
+ ret = __bch2_topology_error (c , & buf );
145
+ bch2_print_str (c , KERN_ERR , buf .buf );
146
+ BUG_ON (!ret );
147
+ goto out ;
149
148
}
150
149
151
150
/* Calculate ideal packed bkey format for new btree nodes: */
0 commit comments