From: Fan Yong Date: Tue, 19 Sep 2017 15:55:59 +0000 (-0400) Subject: LU-9887 lfsck: calculate LFSCK speed properly X-Git-Tag: 2.10.2-RC1~39 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0f14db83ab0fe0b505e3eabb7b51619cd42e5155;p=fs%2Flustre-release.git LU-9887 lfsck: calculate LFSCK speed properly Originally, we used do_div(a,b) to calculate the LFSCK average speed, and got the result from the parameter @a. But later, we replaced do_div(a,b) with div_u64(a,b). The latter one doesn't stores the quotient in the parameter @a, instead, the quotient is returned via the function return value. The patch fixes the LFSCK logic to obtain the LFSCK average speed from div_u64(a,b) return value. Lustre-change: https://review.whamcloud.com/28617 Lustre-commit: cf800c062c8c6424c442509139297095f8a708db Signed-off-by: Fan Yong Change-Id: I442fb8f7e6c51a4853ea37694e3c221f97e26b19 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/29294 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index 98360e16..4a37fda 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -5889,9 +5889,9 @@ static void lfsck_layout_dump(const struct lu_env *env, cfs_duration_sec(duration + HALF_SEC); if (duration != 0) - do_div(new_checked, duration); + new_checked = div64_s64(new_checked, duration); if (rtime != 0) - do_div(speed, rtime); + speed = div64_s64(speed, rtime); seq_printf(m, "checked_phase1: %llu\n" "checked_phase2: %llu\n" "run_time_phase1: %u seconds\n" @@ -5936,11 +5936,11 @@ static void lfsck_layout_dump(const struct lu_env *env, cfs_duration_sec(duration + HALF_SEC); if (duration != 0) - do_div(new_checked, duration); + new_checked = div64_s64(new_checked, duration); if (lo->ll_run_time_phase1 != 0) - do_div(speed1, lo->ll_run_time_phase1); + speed1 = div64_s64(speed1, lo->ll_run_time_phase1); if (rtime != 0) - do_div(speed2, rtime); + speed2 = div64_s64(speed2, rtime); seq_printf(m, "checked_phase1: %llu\n" "checked_phase2: %llu\n" "run_time_phase1: %u seconds\n" @@ -5963,9 +5963,9 @@ static void lfsck_layout_dump(const struct lu_env *env, __u64 speed2 = lo->ll_objs_checked_phase2; if (lo->ll_run_time_phase1 != 0) - do_div(speed1, lo->ll_run_time_phase1); + speed1 = div64_s64(speed1, lo->ll_run_time_phase1); if (lo->ll_run_time_phase2 != 0) - do_div(speed2, lo->ll_run_time_phase2); + speed2 = div64_s64(speed2, lo->ll_run_time_phase2); seq_printf(m, "checked_phase1: %llu\n" "checked_phase2: %llu\n" "run_time_phase1: %u seconds\n" diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 5f0a6d4..896dcb3 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -4436,10 +4436,10 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, cfs_duration_sec(duration + HALF_SEC); if (duration != 0) - do_div(new_checked, duration); + new_checked = div64_s64(new_checked, duration); if (rtime != 0) - do_div(speed, rtime); + speed = div64_s64(speed, rtime); lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0, bk->lb_param & LPF_DRYRUN); @@ -4499,20 +4499,20 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, __u32 time0 = ns->ln_run_time_phase1 + rtime; if (duration != 0) - do_div(new_checked, duration); + new_checked = div64_s64(new_checked, duration); if (ns->ln_run_time_phase1 != 0) - do_div(speed1, ns->ln_run_time_phase1); + speed1 = div64_s64(speed1, ns->ln_run_time_phase1); else if (ns->ln_items_checked != 0) time0++; if (rtime != 0) - do_div(speed2, rtime); + speed2 = div64_s64(speed2, rtime); else if (checked != 0) time0++; if (time0 != 0) - do_div(speed0, time0); + speed0 = div64_s64(speed0, time0); lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked, checked, @@ -4536,17 +4536,17 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com, __u32 time0 = ns->ln_run_time_phase1 + ns->ln_run_time_phase2; if (ns->ln_run_time_phase1 != 0) - do_div(speed1, ns->ln_run_time_phase1); + speed1 = div64_s64(speed1, ns->ln_run_time_phase1); else if (ns->ln_items_checked != 0) time0++; if (ns->ln_run_time_phase2 != 0) - do_div(speed2, ns->ln_run_time_phase2); + speed2 = div64_s64(speed2, ns->ln_run_time_phase2); else if (ns->ln_objs_checked_phase2 != 0) time0++; if (time0 != 0) - do_div(speed0, time0); + speed0 = div64_s64(speed0, time0); lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked, ns->ln_objs_checked_phase2, diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index c5eb9b6..b8c3d1c 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -1050,7 +1050,7 @@ test_9a() { [ $SPEED -lt $MAX_SPEED ] || { $SHOW_LAYOUT log "speed1: $BASE_SPEED1 time1: $RUN_TIME1" - error_ignore LU-9887 "(4) Speed $SPEED, expected < $MAX_SPEED" + error "(4) Speed $SPEED, expected < $MAX_SPEED" } # adjust speed limit @@ -1083,7 +1083,7 @@ test_9a() { $SHOW_LAYOUT log "speed1: $BASE_SPEED1 time1: $RUN_TIME1" log "speed2: $BASE_SPEED2 time2: $RUN_TIME2" - error_ignore LU-9887 "(6) Speed $SPEED, expected < $MAX_SPEED" + error "(6) Speed $SPEED, expected < $MAX_SPEED" } do_facet $SINGLEMDS \ @@ -1149,7 +1149,7 @@ test_9b() { [ $SPEED -lt $MAX_SPEED ] || { $SHOW_NAMESPACE log "speed1: $BASE_SPEED1 time1: $RUN_TIME1" - error_ignore LU-9887 "(8) Speed $SPEED, expected < $MAX_SPEED" + error "(8) Speed $SPEED, expected < $MAX_SPEED" } # adjust speed limit @@ -1182,7 +1182,7 @@ test_9b() { $SHOW_NAMESPACE log "speed1: $BASE_SPEED1 time1: $RUN_TIME1" log "speed2: $BASE_SPEED2 time2: $RUN_TIME2" - error_ignore LU-9887 "(10) Speed $SPEED, expected < $MAX_SPEED" + error "(10) Speed $SPEED, expected < $MAX_SPEED" } do_facet $SINGLEMDS \