407
410
fprintf(stderr, "%s %s\n", whoami, VERSION);
413
#define P_(singular, plural, n) ((n) == 1 ? (singular) : (plural))
415
static void show_stats(o2fsck_state *ost)
417
uint32_t dir_links, num_links;
419
if (!ost->ost_show_stats)
422
dir_links = ost->ost_dir_count;
423
num_links = ost->ost_links_count - ost->ost_dir_count;
425
printf("\n # of inodes with depth 0/1/2/3/4/5: %u/%u/%u/%u/%u/%u\n",
426
ost->ost_tree_depth_count[0], ost->ost_tree_depth_count[1],
427
ost->ost_tree_depth_count[2], ost->ost_tree_depth_count[3],
428
ost->ost_tree_depth_count[4], ost->ost_tree_depth_count[5]);
429
printf(" # of orphaned inodes found/deleted: %u/%u\n",
430
ost->ost_orphan_count, ost->ost_orphan_deleted_count);
432
printf(P_("\n%12u regular file", "\n%12u regular files",
433
ost->ost_file_count), ost->ost_file_count);
434
printf(P_(" (%u inline,", " (%u inlines,",
435
ost->ost_inline_file_count), ost->ost_inline_file_count);
436
printf(P_(" %u reflink)\n", " %u reflinks)\n",
437
ost->ost_reflinks_count), ost->ost_reflinks_count);
438
printf(P_("%12u directory", "%12u directories",
439
ost->ost_dir_count), ost->ost_dir_count);
440
printf(P_(" (%u inline)\n", " (%u inlines)\n",
441
ost->ost_inline_dir_count), ost->ost_inline_dir_count);
442
printf(P_("%12u character device file\n",
443
"%12u character device files\n", ost->ost_chardev_count),
444
ost->ost_chardev_count);
445
printf(P_("%12u block device file\n", "%12u block device files\n",
446
ost->ost_blockdev_count), ost->ost_blockdev_count);
447
printf(P_("%12u fifo\n", "%12u fifos\n", ost->ost_fifo_count),
448
ost->ost_fifo_count);
449
printf(P_("%12u link\n", "%12u links\n", num_links), num_links);
450
printf(P_("%12u symbolic link", "%12u symbolic links",
451
ost->ost_symlinks_count), ost->ost_symlinks_count);
452
printf(P_(" (%u fast symbolic link)\n", " (%u fast symbolic links)\n",
453
ost->ost_fast_symlinks_count), ost->ost_fast_symlinks_count);
454
printf(P_("%12u socket\n", "%12u sockets\n", ost->ost_sockets_count),
455
ost->ost_sockets_count);
410
459
static errcode_t open_and_check(o2fsck_state *ost, char *filename,
411
460
int open_flags, uint64_t blkno,
412
461
uint64_t blksize)
591
640
!strcmp(running.c_cluster, disk.c_cluster)))
643
#define RECOVER_CLUSTER_WARNING \
644
"The running cluster is using the %s stack\n" \
645
"%s%s, but the filesystem is configured for\n" \
646
"the %s stack%s%s. Thus, %s cannot\n" \
647
"determine whether the filesystem is in use or not. This utility can\n"\
648
"reconfigure the filesystem to use the currently running cluster configuration.\n"\
649
"DANGER: YOU MUST BE ABSOLUTELY SURE THAT NO OTHER NODE IS USING THIS\n"\
650
"FILESYSTEM BEFORE MODIFYING ITS CLUSTER CONFIGURATION.\n" \
651
"Recover cluster configuration information the running cluster?"
594
653
/* recover the backup information to superblock. */
595
if (prompt(ost, PN, PR_RECOVER_CLUSTER_INFO,
596
"The running cluster is using the %s stack%s%s, but "
597
"the filesystem is configured for the %s stack%s%s. "
598
"Thus, %s cannot determine whether the filesystem is in "
599
"use. %s can reconfigure the filesystem to use the "
600
"currently running cluster configuration. DANGER: "
601
"YOU MUST BE ABSOLUTELY SURE THAT NO OTHER NODE IS "
602
"USING THIS FILESYSTEM BEFORE MODIFYING ITS CLUSTER "
603
"CONFIGURATION. Recover cluster configuration "
604
"information the running cluster?",
654
if (prompt(ost, PN, PR_RECOVER_CLUSTER_INFO, RECOVER_CLUSTER_WARNING,
605
655
running.c_stack ? running.c_stack : "classic o2cb",
606
running.c_stack ? " with the cluster name " : "",
656
running.c_stack ? "with the cluster name " : "",
607
657
running.c_stack ? running.c_cluster : "",
608
658
disk.c_stack ? disk.c_stack : "classic o2cb",
609
659
disk.c_stack ? " with the cluster name " : "",
610
disk.c_stack ? disk.c_cluster : "", whoami, whoami)) {
660
disk.c_stack ? disk.c_cluster : "", whoami)) {
611
661
ret = ocfs2_set_cluster_desc(ost->ost_fs, &running);