Lines Matching full:out

44 void bch2_version_to_text(struct printbuf *out, unsigned v)  in bch2_version_to_text()  argument
54 prt_printf(out, "%u.%u: %s", BCH_VERSION_MAJOR(v), BCH_VERSION_MINOR(v), str); in bch2_version_to_text()
261 static int validate_sb_layout(struct bch_sb_layout *layout, struct printbuf *out) in validate_sb_layout() argument
270 prt_printf(out, "Not a bcachefs superblock layout"); in validate_sb_layout()
275 prt_printf(out, "Invalid superblock layout type %u", in validate_sb_layout()
281 prt_printf(out, "Invalid superblock layout: no superblocks"); in validate_sb_layout()
286 prt_printf(out, "Invalid superblock layout: too many superblocks"); in validate_sb_layout()
298 prt_printf(out, "Invalid superblock layout: superblocks overlap\n" in validate_sb_layout()
309 static int bch2_sb_compatible(struct bch_sb *sb, struct printbuf *out) in bch2_sb_compatible() argument
315 prt_str(out, "Unsupported superblock version "); in bch2_sb_compatible()
316 bch2_version_to_text(out, version); in bch2_sb_compatible()
317 prt_str(out, " (min "); in bch2_sb_compatible()
318 bch2_version_to_text(out, bcachefs_metadata_version_min); in bch2_sb_compatible()
319 prt_str(out, ", max "); in bch2_sb_compatible()
320 bch2_version_to_text(out, bcachefs_metadata_version_current); in bch2_sb_compatible()
321 prt_str(out, ")"); in bch2_sb_compatible()
326 prt_str(out, "Unsupported superblock version_min "); in bch2_sb_compatible()
327 bch2_version_to_text(out, version_min); in bch2_sb_compatible()
328 prt_str(out, " (min "); in bch2_sb_compatible()
329 bch2_version_to_text(out, bcachefs_metadata_version_min); in bch2_sb_compatible()
330 prt_str(out, ", max "); in bch2_sb_compatible()
331 bch2_version_to_text(out, bcachefs_metadata_version_current); in bch2_sb_compatible()
332 prt_str(out, ")"); in bch2_sb_compatible()
337 prt_str(out, "Bad minimum version "); in bch2_sb_compatible()
338 bch2_version_to_text(out, version_min); in bch2_sb_compatible()
339 prt_str(out, ", greater than version field "); in bch2_sb_compatible()
340 bch2_version_to_text(out, version); in bch2_sb_compatible()
347 static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out, in bch2_sb_validate() argument
356 ret = bch2_sb_compatible(sb, out); in bch2_sb_validate()
362 prt_printf(out, "Filesystem has incompatible features"); in bch2_sb_validate()
369 prt_printf(out, "Block size too big (got %u, max %u)", in bch2_sb_validate()
375 prt_printf(out, "Bad user UUID (got zeroes)"); in bch2_sb_validate()
380 prt_printf(out, "Bad internal UUID (got zeroes)"); in bch2_sb_validate()
386 prt_printf(out, "Bad number of member devices %u (max %u)", in bch2_sb_validate()
392 prt_printf(out, "Bad dev_idx (got %u, nr_devices %u)", in bch2_sb_validate()
399 prt_printf(out, "Invalid time precision: %u (min 1, max %lu)", in bch2_sb_validate()
425 prt_printf(out, "Invalid option "); in bch2_sb_validate()
426 ret = bch2_opt_validate(opt, v, out); in bch2_sb_validate()
430 printbuf_reset(out); in bch2_sb_validate()
435 ret = validate_sb_layout(&sb->layout, out); in bch2_sb_validate()
441 prt_printf(out, "Invalid superblock: optional field with size 0 (type %u)", in bch2_sb_validate()
447 prt_printf(out, "Invalid superblock: optional field extends past end of superblock (type %u)", in bch2_sb_validate()
456 prt_printf(out, "Invalid superblock: member info area missing"); in bch2_sb_validate()
460 ret = bch2_sb_field_validate(sb, &mi->field, out); in bch2_sb_validate()
468 ret = bch2_sb_field_validate(sb, f, out); in bch2_sb_validate()
815 out: in __bch2_read_super()
823 goto out; in __bch2_read_super()
959 goto out; in bch2_write_super()
964 goto out; in bch2_write_super()
968 * complete - don't write out a partly initialized superblock: in bch2_write_super()
971 goto out; in bch2_write_super()
1005 goto out; in bch2_write_super()
1015 goto out; in bch2_write_super()
1064 out: in bch2_write_super()
1135 static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb, in bch2_sb_ext_to_text() argument
1140 prt_printf(out, "Recovery passes required:"); in bch2_sb_ext_to_text()
1141 prt_tab(out); in bch2_sb_ext_to_text()
1142 prt_bitflags(out, bch2_recovery_passes, in bch2_sb_ext_to_text()
1144 prt_newline(out); in bch2_sb_ext_to_text()
1150 prt_printf(out, "Errors to silently fix:"); in bch2_sb_ext_to_text()
1151 prt_tab(out); in bch2_sb_ext_to_text()
1152 prt_bitflags_vector(out, bch2_sb_error_strs, errors_silent, sizeof(e->errors_silent) * 8); in bch2_sb_ext_to_text()
1153 prt_newline(out); in bch2_sb_ext_to_text()
1200 void __bch2_sb_field_to_text(struct printbuf *out, struct bch_sb *sb, in __bch2_sb_field_to_text() argument
1206 if (!out->nr_tabstops) in __bch2_sb_field_to_text()
1207 printbuf_tabstop_push(out, 32); in __bch2_sb_field_to_text()
1210 ops->to_text(out, sb, f); in __bch2_sb_field_to_text()
1213 void bch2_sb_field_to_text(struct printbuf *out, struct bch_sb *sb, in bch2_sb_field_to_text() argument
1219 prt_printf(out, "%s", bch2_sb_fields[type]); in bch2_sb_field_to_text()
1221 prt_printf(out, "(unknown field %u)", type); in bch2_sb_field_to_text()
1223 prt_printf(out, " (size %zu):", vstruct_bytes(f)); in bch2_sb_field_to_text()
1224 prt_newline(out); in bch2_sb_field_to_text()
1226 __bch2_sb_field_to_text(out, sb, f); in bch2_sb_field_to_text()
1229 void bch2_sb_layout_to_text(struct printbuf *out, struct bch_sb_layout *l) in bch2_sb_layout_to_text() argument
1233 prt_printf(out, "Type: %u", l->layout_type); in bch2_sb_layout_to_text()
1234 prt_newline(out); in bch2_sb_layout_to_text()
1236 prt_str(out, "Superblock max size: "); in bch2_sb_layout_to_text()
1237 prt_units_u64(out, 512 << l->sb_max_size_bits); in bch2_sb_layout_to_text()
1238 prt_newline(out); in bch2_sb_layout_to_text()
1240 prt_printf(out, "Nr superblocks: %u", l->nr_superblocks); in bch2_sb_layout_to_text()
1241 prt_newline(out); in bch2_sb_layout_to_text()
1243 prt_str(out, "Offsets: "); in bch2_sb_layout_to_text()
1246 prt_str(out, ", "); in bch2_sb_layout_to_text()
1247 prt_printf(out, "%llu", le64_to_cpu(l->sb_offset[i])); in bch2_sb_layout_to_text()
1249 prt_newline(out); in bch2_sb_layout_to_text()
1252 void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, in bch2_sb_to_text() argument
1258 if (!out->nr_tabstops) in bch2_sb_to_text()
1259 printbuf_tabstop_push(out, 44); in bch2_sb_to_text()
1264 prt_printf(out, "External UUID:"); in bch2_sb_to_text()
1265 prt_tab(out); in bch2_sb_to_text()
1266 pr_uuid(out, sb->user_uuid.b); in bch2_sb_to_text()
1267 prt_newline(out); in bch2_sb_to_text()
1269 prt_printf(out, "Internal UUID:"); in bch2_sb_to_text()
1270 prt_tab(out); in bch2_sb_to_text()
1271 pr_uuid(out, sb->uuid.b); in bch2_sb_to_text()
1272 prt_newline(out); in bch2_sb_to_text()
1274 prt_printf(out, "Magic number:"); in bch2_sb_to_text()
1275 prt_tab(out); in bch2_sb_to_text()
1276 pr_uuid(out, sb->magic.b); in bch2_sb_to_text()
1277 prt_newline(out); in bch2_sb_to_text()
1279 prt_str(out, "Device index:"); in bch2_sb_to_text()
1280 prt_tab(out); in bch2_sb_to_text()
1281 prt_printf(out, "%u", sb->dev_idx); in bch2_sb_to_text()
1282 prt_newline(out); in bch2_sb_to_text()
1284 prt_str(out, "Label:"); in bch2_sb_to_text()
1285 prt_tab(out); in bch2_sb_to_text()
1286 prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label); in bch2_sb_to_text()
1287 prt_newline(out); in bch2_sb_to_text()
1289 prt_str(out, "Version:"); in bch2_sb_to_text()
1290 prt_tab(out); in bch2_sb_to_text()
1291 bch2_version_to_text(out, le16_to_cpu(sb->version)); in bch2_sb_to_text()
1292 prt_newline(out); in bch2_sb_to_text()
1294 prt_str(out, "Version upgrade complete:"); in bch2_sb_to_text()
1295 prt_tab(out); in bch2_sb_to_text()
1296 bch2_version_to_text(out, BCH_SB_VERSION_UPGRADE_COMPLETE(sb)); in bch2_sb_to_text()
1297 prt_newline(out); in bch2_sb_to_text()
1299 prt_printf(out, "Oldest version on disk:"); in bch2_sb_to_text()
1300 prt_tab(out); in bch2_sb_to_text()
1301 bch2_version_to_text(out, le16_to_cpu(sb->version_min)); in bch2_sb_to_text()
1302 prt_newline(out); in bch2_sb_to_text()
1304 prt_printf(out, "Created:"); in bch2_sb_to_text()
1305 prt_tab(out); in bch2_sb_to_text()
1307 bch2_prt_datetime(out, div_u64(le64_to_cpu(sb->time_base_lo), NSEC_PER_SEC)); in bch2_sb_to_text()
1309 prt_printf(out, "(not set)"); in bch2_sb_to_text()
1310 prt_newline(out); in bch2_sb_to_text()
1312 prt_printf(out, "Sequence number:"); in bch2_sb_to_text()
1313 prt_tab(out); in bch2_sb_to_text()
1314 prt_printf(out, "%llu", le64_to_cpu(sb->seq)); in bch2_sb_to_text()
1315 prt_newline(out); in bch2_sb_to_text()
1317 prt_printf(out, "Time of last write:"); in bch2_sb_to_text()
1318 prt_tab(out); in bch2_sb_to_text()
1319 bch2_prt_datetime(out, le64_to_cpu(sb->write_time)); in bch2_sb_to_text()
1320 prt_newline(out); in bch2_sb_to_text()
1322 prt_printf(out, "Superblock size:"); in bch2_sb_to_text()
1323 prt_tab(out); in bch2_sb_to_text()
1324 prt_units_u64(out, vstruct_bytes(sb)); in bch2_sb_to_text()
1325 prt_str(out, "/"); in bch2_sb_to_text()
1326 prt_units_u64(out, 512ULL << sb->layout.sb_max_size_bits); in bch2_sb_to_text()
1327 prt_newline(out); in bch2_sb_to_text()
1329 prt_printf(out, "Clean:"); in bch2_sb_to_text()
1330 prt_tab(out); in bch2_sb_to_text()
1331 prt_printf(out, "%llu", BCH_SB_CLEAN(sb)); in bch2_sb_to_text()
1332 prt_newline(out); in bch2_sb_to_text()
1334 prt_printf(out, "Devices:"); in bch2_sb_to_text()
1335 prt_tab(out); in bch2_sb_to_text()
1336 prt_printf(out, "%u", nr_devices); in bch2_sb_to_text()
1337 prt_newline(out); in bch2_sb_to_text()
1339 prt_printf(out, "Sections:"); in bch2_sb_to_text()
1342 prt_tab(out); in bch2_sb_to_text()
1343 prt_bitflags(out, bch2_sb_fields, fields_have); in bch2_sb_to_text()
1344 prt_newline(out); in bch2_sb_to_text()
1346 prt_printf(out, "Features:"); in bch2_sb_to_text()
1347 prt_tab(out); in bch2_sb_to_text()
1348 prt_bitflags(out, bch2_sb_features, le64_to_cpu(sb->features[0])); in bch2_sb_to_text()
1349 prt_newline(out); in bch2_sb_to_text()
1351 prt_printf(out, "Compat features:"); in bch2_sb_to_text()
1352 prt_tab(out); in bch2_sb_to_text()
1353 prt_bitflags(out, bch2_sb_compat, le64_to_cpu(sb->compat[0])); in bch2_sb_to_text()
1354 prt_newline(out); in bch2_sb_to_text()
1356 prt_newline(out); in bch2_sb_to_text()
1357 prt_printf(out, "Options:"); in bch2_sb_to_text()
1358 prt_newline(out); in bch2_sb_to_text()
1359 printbuf_indent_add(out, 2); in bch2_sb_to_text()
1369 prt_printf(out, "%s:", opt->attr.name); in bch2_sb_to_text()
1370 prt_tab(out); in bch2_sb_to_text()
1371 bch2_opt_to_text(out, NULL, sb, opt, v, in bch2_sb_to_text()
1373 prt_newline(out); in bch2_sb_to_text()
1378 printbuf_indent_sub(out, 2); in bch2_sb_to_text()
1381 prt_newline(out); in bch2_sb_to_text()
1382 prt_printf(out, "layout:"); in bch2_sb_to_text()
1383 prt_newline(out); in bch2_sb_to_text()
1384 printbuf_indent_add(out, 2); in bch2_sb_to_text()
1385 bch2_sb_layout_to_text(out, &sb->layout); in bch2_sb_to_text()
1386 printbuf_indent_sub(out, 2); in bch2_sb_to_text()
1391 prt_newline(out); in bch2_sb_to_text()
1392 bch2_sb_field_to_text(out, sb, f); in bch2_sb_to_text()