Lines Matching refs:out

44 void bch2_version_to_text(struct printbuf *out, unsigned v)
54 prt_printf(out, "%u.%u: %s", BCH_VERSION_MAJOR(v), BCH_VERSION_MINOR(v), str);
261 static int validate_sb_layout(struct bch_sb_layout *layout, struct printbuf *out)
270 prt_printf(out, "Not a bcachefs superblock layout");
275 prt_printf(out, "Invalid superblock layout type %u",
281 prt_printf(out, "Invalid superblock layout: no superblocks");
286 prt_printf(out, "Invalid superblock layout: too many superblocks");
298 prt_printf(out, "Invalid superblock layout: superblocks overlap\n"
309 static int bch2_sb_compatible(struct bch_sb *sb, struct printbuf *out)
315 prt_str(out, "Unsupported superblock version ");
316 bch2_version_to_text(out, version);
317 prt_str(out, " (min ");
318 bch2_version_to_text(out, bcachefs_metadata_version_min);
319 prt_str(out, ", max ");
320 bch2_version_to_text(out, bcachefs_metadata_version_current);
321 prt_str(out, ")");
326 prt_str(out, "Unsupported superblock version_min ");
327 bch2_version_to_text(out, version_min);
328 prt_str(out, " (min ");
329 bch2_version_to_text(out, bcachefs_metadata_version_min);
330 prt_str(out, ", max ");
331 bch2_version_to_text(out, bcachefs_metadata_version_current);
332 prt_str(out, ")");
337 prt_str(out, "Bad minimum version ");
338 bch2_version_to_text(out, version_min);
339 prt_str(out, ", greater than version field ");
340 bch2_version_to_text(out, version);
348 enum bch_validate_flags flags, struct printbuf *out)
356 ret = bch2_sb_compatible(sb, out);
362 prt_printf(out, "Filesystem has incompatible features");
369 prt_printf(out, "Block size too big (got %u, max %u)",
375 prt_printf(out, "Bad user UUID (got zeroes)");
380 prt_printf(out, "Bad internal UUID (got zeroes)");
386 prt_printf(out, "Bad number of member devices %u (max %u)",
392 prt_printf(out, "Bad dev_idx (got %u, nr_devices %u)",
399 prt_printf(out, "Invalid time precision: %u (min 1, max %lu)",
425 prt_printf(out, "Invalid option ");
426 ret = bch2_opt_validate(opt, v, out);
430 printbuf_reset(out);
435 ret = validate_sb_layout(&sb->layout, out);
441 prt_printf(out, "Invalid superblock: optional field with size 0 (type %u)",
447 prt_printf(out, "Invalid superblock: optional field extends past end of superblock (type %u)",
456 prt_printf(out, "Invalid superblock: member info area missing");
460 ret = bch2_sb_field_validate(sb, &mi->field, flags, out);
468 ret = bch2_sb_field_validate(sb, f, flags, out);
475 prt_printf(out, "Invalid superblock: member seq %llu != sb seq %llu",
828 out:
836 goto out;
943 goto out;
981 goto out;
986 goto out;
990 * complete - don't write out a partly initialized superblock:
993 goto out;
1050 goto out;
1100 out:
1168 static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb,
1173 prt_printf(out, "Recovery passes required:\t");
1174 prt_bitflags(out, bch2_recovery_passes,
1176 prt_newline(out);
1182 prt_printf(out, "Errors to silently fix:\t");
1183 prt_bitflags_vector(out, bch2_sb_error_strs, errors_silent, sizeof(e->errors_silent) * 8);
1184 prt_newline(out);
1189 prt_printf(out, "Btrees with missing data:\t");
1190 prt_bitflags(out, __bch2_btree_ids, le64_to_cpu(e->btrees_lost_data));
1191 prt_newline(out);
1235 void __bch2_sb_field_to_text(struct printbuf *out, struct bch_sb *sb,
1241 if (!out->nr_tabstops)
1242 printbuf_tabstop_push(out, 32);
1245 ops->to_text(out, sb, f);
1248 void bch2_sb_field_to_text(struct printbuf *out, struct bch_sb *sb,
1254 prt_printf(out, "%s", bch2_sb_fields[type]);
1256 prt_printf(out, "(unknown field %u)", type);
1258 prt_printf(out, " (size %zu):", vstruct_bytes(f));
1259 prt_newline(out);
1261 __bch2_sb_field_to_text(out, sb, f);
1264 void bch2_sb_layout_to_text(struct printbuf *out, struct bch_sb_layout *l)
1268 prt_printf(out, "Type: %u", l->layout_type);
1269 prt_newline(out);
1271 prt_str(out, "Superblock max size: ");
1272 prt_units_u64(out, 512 << l->sb_max_size_bits);
1273 prt_newline(out);
1275 prt_printf(out, "Nr superblocks: %u", l->nr_superblocks);
1276 prt_newline(out);
1278 prt_str(out, "Offsets: ");
1281 prt_str(out, ", ");
1282 prt_printf(out, "%llu", le64_to_cpu(l->sb_offset[i]));
1284 prt_newline(out);
1287 void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb,
1293 if (!out->nr_tabstops)
1294 printbuf_tabstop_push(out, 44);
1299 prt_printf(out, "External UUID:\t");
1300 pr_uuid(out, sb->user_uuid.b);
1301 prt_newline(out);
1303 prt_printf(out, "Internal UUID:\t");
1304 pr_uuid(out, sb->uuid.b);
1305 prt_newline(out);
1307 prt_printf(out, "Magic number:\t");
1308 pr_uuid(out, sb->magic.b);
1309 prt_newline(out);
1311 prt_printf(out, "Device index:\t%u\n", sb->dev_idx);
1313 prt_printf(out, "Label:\t");
1314 prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label);
1315 prt_newline(out);
1317 prt_printf(out, "Version:\t");
1318 bch2_version_to_text(out, le16_to_cpu(sb->version));
1319 prt_newline(out);
1321 prt_printf(out, "Version upgrade complete:\t");
1322 bch2_version_to_text(out, BCH_SB_VERSION_UPGRADE_COMPLETE(sb));
1323 prt_newline(out);
1325 prt_printf(out, "Oldest version on disk:\t");
1326 bch2_version_to_text(out, le16_to_cpu(sb->version_min));
1327 prt_newline(out);
1329 prt_printf(out, "Created:\t");
1331 bch2_prt_datetime(out, div_u64(le64_to_cpu(sb->time_base_lo), NSEC_PER_SEC));
1333 prt_printf(out, "(not set)");
1334 prt_newline(out);
1336 prt_printf(out, "Sequence number:\t");
1337 prt_printf(out, "%llu", le64_to_cpu(sb->seq));
1338 prt_newline(out);
1340 prt_printf(out, "Time of last write:\t");
1341 bch2_prt_datetime(out, le64_to_cpu(sb->write_time));
1342 prt_newline(out);
1344 prt_printf(out, "Superblock size:\t");
1345 prt_units_u64(out, vstruct_bytes(sb));
1346 prt_str(out, "/");
1347 prt_units_u64(out, 512ULL << sb->layout.sb_max_size_bits);
1348 prt_newline(out);
1350 prt_printf(out, "Clean:\t%llu\n", BCH_SB_CLEAN(sb));
1351 prt_printf(out, "Devices:\t%u\n", nr_devices);
1353 prt_printf(out, "Sections:\t");
1356 prt_bitflags(out, bch2_sb_fields, fields_have);
1357 prt_newline(out);
1359 prt_printf(out, "Features:\t");
1360 prt_bitflags(out, bch2_sb_features, le64_to_cpu(sb->features[0]));
1361 prt_newline(out);
1363 prt_printf(out, "Compat features:\t");
1364 prt_bitflags(out, bch2_sb_compat, le64_to_cpu(sb->compat[0]));
1365 prt_newline(out);
1367 prt_newline(out);
1368 prt_printf(out, "Options:");
1369 prt_newline(out);
1370 printbuf_indent_add(out, 2);
1380 prt_printf(out, "%s:\t", opt->attr.name);
1381 bch2_opt_to_text(out, NULL, sb, opt, v,
1383 prt_newline(out);
1388 printbuf_indent_sub(out, 2);
1391 prt_newline(out);
1392 prt_printf(out, "layout:");
1393 prt_newline(out);
1394 printbuf_indent_add(out, 2);
1395 bch2_sb_layout_to_text(out, &sb->layout);
1396 printbuf_indent_sub(out, 2);
1401 prt_newline(out);
1402 bch2_sb_field_to_text(out, sb, f);