From caac78f3f30f6f556671c5049ccd0f98764f572e Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Tue, 13 Jun 2017 18:52:43 +0800 Subject: [PATCH] LU-9545 lfsck: report "inconsistent" under dryrun mode It is confused to report the item as "fixed" under dryrun mode LFSCK. Instead, report them as "inconsistent". Signed-off-by: Fan Yong Change-Id: I22e056d7143a55e0dc06d9a891f4126522b466c9 Reviewed-on: https://review.whamcloud.com/27606 Reviewed-by: James Simmons Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Dmitry Eremin --- lustre/lfsck/lfsck_layout.c | 30 ++++++++++-------- lustre/lfsck/lfsck_namespace.c | 70 +++++++++++++++++++++++------------------- lustre/osd-ldiskfs/osd_scrub.c | 20 ++++++++---- 3 files changed, 71 insertions(+), 49 deletions(-) diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index b0179a7..c445303 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -5816,8 +5816,14 @@ static void lfsck_layout_dump(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; struct lfsck_layout *lo = com->lc_file_ram; + const char *prefix; down_read(&com->lc_sem); + if (bk->lb_param & LPF_DRYRUN) + prefix = "inconsistent"; + else + prefix = "repaired"; + seq_printf(m, "name: lfsck_layout\n" "magic: %#x\n" "version: %d\n" @@ -5844,22 +5850,22 @@ static void lfsck_layout_dump(const struct lu_env *env, lo->ll_pos_first_inconsistent); seq_printf(m, "success_count: %u\n" - "repaired_dangling: %llu\n" - "repaired_unmatched_pair: %llu\n" - "repaired_multiple_referenced: %llu\n" - "repaired_orphan: %llu\n" - "repaired_inconsistent_owner: %llu\n" - "repaired_others: %llu\n" + "%s_dangling: %llu\n" + "%s_unmatched_pair: %llu\n" + "%s_multiple_referenced: %llu\n" + "%s_orphan: %llu\n" + "%s_inconsistent_owner: %llu\n" + "%s_others: %llu\n" "skipped: %llu\n" "failed_phase1: %llu\n" "failed_phase2: %llu\n", lo->ll_success_count, - lo->ll_objs_repaired[LLIT_DANGLING - 1], - lo->ll_objs_repaired[LLIT_UNMATCHED_PAIR - 1], - lo->ll_objs_repaired[LLIT_MULTIPLE_REFERENCED - 1], - lo->ll_objs_repaired[LLIT_ORPHAN - 1], - lo->ll_objs_repaired[LLIT_INCONSISTENT_OWNER - 1], - lo->ll_objs_repaired[LLIT_OTHERS - 1], + prefix, lo->ll_objs_repaired[LLIT_DANGLING - 1], + prefix, lo->ll_objs_repaired[LLIT_UNMATCHED_PAIR - 1], + prefix, lo->ll_objs_repaired[LLIT_MULTIPLE_REFERENCED - 1], + prefix, lo->ll_objs_repaired[LLIT_ORPHAN - 1], + prefix, lo->ll_objs_repaired[LLIT_INCONSISTENT_OWNER - 1], + prefix, lo->ll_objs_repaired[LLIT_OTHERS - 1], lo->ll_objs_skipped, lo->ll_objs_failed_phase1, lo->ll_objs_failed_phase2); diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 67dcd60..5f0a6d4 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -3748,76 +3748,81 @@ static void lfsck_namespace_dump_statistics(struct seq_file *m, __u64 checked_phase1, __u64 checked_phase2, __u32 time_phase1, - __u32 time_phase2) + __u32 time_phase2, bool dryrun) { + const char *postfix = dryrun ? "inconsistent" : "repaired"; + seq_printf(m, "checked_phase1: %llu\n" "checked_phase2: %llu\n" - "updated_phase1: %llu\n" - "updated_phase2: %llu\n" + "%s_phase1: %llu\n" + "%s_phase2: %llu\n" "failed_phase1: %llu\n" "failed_phase2: %llu\n" "directories: %llu\n" - "dirent_repaired: %llu\n" - "linkea_repaired: %llu\n" - "nlinks_repaired: %llu\n" + "dirent_%s: %llu\n" + "linkea_%s: %llu\n" + "nlinks_%s: %llu\n" "multiple_linked_checked: %llu\n" - "multiple_linked_repaired: %llu\n" + "multiple_linked_%s: %llu\n" "unknown_inconsistency: %llu\n" - "unmatched_pairs_repaired: %llu\n" - "dangling_repaired: %llu\n" - "multiple_referenced_repaired: %llu\n" - "bad_file_type_repaired: %llu\n" - "lost_dirent_repaired: %llu\n" + "unmatched_pairs_%s: %llu\n" + "dangling_%s: %llu\n" + "multiple_referenced_%s: %llu\n" + "bad_file_type_%s: %llu\n" + "lost_dirent_%s: %llu\n" "local_lost_found_scanned: %llu\n" "local_lost_found_moved: %llu\n" "local_lost_found_skipped: %llu\n" "local_lost_found_failed: %llu\n" "striped_dirs_scanned: %llu\n" - "striped_dirs_repaired: %llu\n" + "striped_dirs_%s: %llu\n" "striped_dirs_failed: %llu\n" "striped_dirs_disabled: %llu\n" "striped_dirs_skipped: %llu\n" "striped_shards_scanned: %llu\n" - "striped_shards_repaired: %llu\n" + "striped_shards_%s: %llu\n" "striped_shards_failed: %llu\n" "striped_shards_skipped: %llu\n" - "name_hash_repaired: %llu\n" - "linkea_overflow_cleared: %llu\n" + "name_hash_%s: %llu\n" + "linkea_overflow_%s: %llu\n" "success_count: %u\n" "run_time_phase1: %u seconds\n" "run_time_phase2: %u seconds\n", checked_phase1, checked_phase2, + dryrun ? "inconsistent" : "updated", ns->ln_items_repaired, + dryrun ? "inconsistent" : "updated", ns->ln_objs_repaired_phase2, ns->ln_items_failed, ns->ln_objs_failed_phase2, ns->ln_dirs_checked, - ns->ln_dirent_repaired, - ns->ln_linkea_repaired, - ns->ln_objs_nlink_repaired, + postfix, ns->ln_dirent_repaired, + postfix, ns->ln_linkea_repaired, + postfix, ns->ln_objs_nlink_repaired, ns->ln_mul_linked_checked, - ns->ln_mul_linked_repaired, + postfix, ns->ln_mul_linked_repaired, ns->ln_unknown_inconsistency, - ns->ln_unmatched_pairs_repaired, - ns->ln_dangling_repaired, - ns->ln_mul_ref_repaired, - ns->ln_bad_type_repaired, - ns->ln_lost_dirent_repaired, + postfix, ns->ln_unmatched_pairs_repaired, + postfix, ns->ln_dangling_repaired, + postfix, ns->ln_mul_ref_repaired, + postfix, ns->ln_bad_type_repaired, + postfix, ns->ln_lost_dirent_repaired, ns->ln_local_lpf_scanned, ns->ln_local_lpf_moved, ns->ln_local_lpf_skipped, ns->ln_local_lpf_failed, ns->ln_striped_dirs_scanned, - ns->ln_striped_dirs_repaired, + postfix, ns->ln_striped_dirs_repaired, ns->ln_striped_dirs_failed, ns->ln_striped_dirs_disabled, ns->ln_striped_dirs_skipped, ns->ln_striped_shards_scanned, - ns->ln_striped_shards_repaired, + postfix, ns->ln_striped_shards_repaired, ns->ln_striped_shards_failed, ns->ln_striped_shards_skipped, - ns->ln_name_hash_repaired, + postfix, ns->ln_name_hash_repaired, + dryrun ? "inconsistent" : "cleared", ns->ln_linkea_overflow_cleared, ns->ln_success_count, time_phase1, @@ -4436,7 +4441,8 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, if (rtime != 0) do_div(speed, rtime); - lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0); + lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0, + bk->lb_param & LPF_DRYRUN); seq_printf(m, "average_speed_phase1: %llu items/sec\n" "average_speed_phase2: N/A\n" "average_speed_total: %llu items/sec\n" @@ -4510,7 +4516,8 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked, checked, - ns->ln_run_time_phase1, rtime); + ns->ln_run_time_phase1, rtime, + bk->lb_param & LPF_DRYRUN); seq_printf(m, "average_speed_phase1: %llu items/sec\n" "average_speed_phase2: %llu objs/sec\n" "average_speed_total: %llu items/sec\n" @@ -4544,7 +4551,8 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked, ns->ln_objs_checked_phase2, ns->ln_run_time_phase1, - ns->ln_run_time_phase2); + ns->ln_run_time_phase2, + bk->lb_param & LPF_DRYRUN); seq_printf(m, "average_speed_phase1: %llu items/sec\n" "average_speed_phase2: %llu objs/sec\n" "average_speed_total: %llu items/sec\n" diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index a88c7ef..c94a3b0 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -3314,13 +3314,16 @@ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev) checked = sf->sf_items_checked + scrub->os_new_checked; seq_printf(m, "checked: %llu\n" - "updated: %llu\n" + "%s: %llu\n" "failed: %llu\n" - "prior_updated: %llu\n" + "prior_%s: %llu\n" "noscrub: %llu\n" "igif: %llu\n" "success_count: %u\n", - checked, sf->sf_items_updated, sf->sf_items_failed, + checked, + sf->sf_param & SP_DRYRUN ? "inconsistent" : "updated", + sf->sf_items_updated, sf->sf_items_failed, + sf->sf_param & SP_DRYRUN ? "inconsistent" : "updated", sf->sf_items_updated_prior, sf->sf_items_noscrub, sf->sf_items_igif, sf->sf_success_count); @@ -3342,10 +3345,13 @@ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev) "real-time_speed: %llu objects/sec\n" "current_position: %u\n" "lf_scanned: %llu\n" - "lf_repaired: %llu\n" + "lf_%s: %llu\n" "lf_failed: %llu\n", rtime, speed, new_checked, scrub->os_pos_current, - scrub->os_lf_scanned, scrub->os_lf_repaired, + scrub->os_lf_scanned, + sf->sf_param & SP_DRYRUN ? + "inconsistent" : "repaired", + scrub->os_lf_repaired, scrub->os_lf_failed); seq_printf(m, "inodes_per_group: %lu\n" "current_iit_group: %u\n" @@ -3369,9 +3375,11 @@ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev) "real-time_speed: N/A\n" "current_position: N/A\n" "lf_scanned: %llu\n" - "lf_repaired: %llu\n" + "lf_%s: %llu\n" "lf_failed: %llu\n", sf->sf_run_time, speed, scrub->os_lf_scanned, + sf->sf_param & SP_DRYRUN ? + "inconsistent" : "repaired", scrub->os_lf_repaired, scrub->os_lf_failed); } -- 1.8.3.1