Whamcloud - gitweb
LU-9887 lfsck: calculate LFSCK speed properly 17/28617/6
authorFan Yong <fan.yong@intel.com>
Tue, 19 Sep 2017 15:55:59 +0000 (11:55 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 30 Sep 2017 04:40:52 +0000 (04:40 +0000)
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.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I442fb8f7e6c51a4853ea37694e3c221f97e26b19
Reviewed-on: https://review.whamcloud.com/28617
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
lustre/lfsck/lfsck_layout.c
lustre/lfsck/lfsck_namespace.c
lustre/tests/sanity-lfsck.sh

index 63868d5..5f6d008 100644 (file)
@@ -5885,9 +5885,9 @@ static void lfsck_layout_dump(const struct lu_env *env,
                u64 pos;
 
                if (duration != 0)
-                       div_u64(new_checked, duration);
+                       new_checked = div64_s64(new_checked, duration);
                if (rtime != 0)
-                       div_u64(speed, rtime);
+                       speed = div64_s64(speed, rtime);
                seq_printf(m, "checked_phase1: %llu\n"
                           "checked_phase2: %llu\n"
                           "run_time_phase1: %lld seconds\n"
@@ -5930,11 +5930,11 @@ static void lfsck_layout_dump(const struct lu_env *env,
                time64_t rtime = lo->ll_run_time_phase2 + duration;
 
                if (duration != 0)
-                       div_u64(new_checked, duration);
+                       new_checked = div64_s64(new_checked, duration);
                if (lo->ll_run_time_phase1 != 0)
-                       div_u64(speed1, lo->ll_run_time_phase1);
+                       speed1 = div64_s64(speed1, lo->ll_run_time_phase1);
                if (rtime != 0)
-                       div_u64(speed2, rtime);
+                       speed2 = div64_s64(speed2, rtime);
                seq_printf(m, "checked_phase1: %llu\n"
                           "checked_phase2: %llu\n"
                           "run_time_phase1: %lld seconds\n"
@@ -5957,9 +5957,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)
-                       div_u64(speed1, lo->ll_run_time_phase1);
+                       speed1 = div64_s64(speed1, lo->ll_run_time_phase1);
                if (lo->ll_run_time_phase2 != 0)
-                       div_u64(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: %lld seconds\n"
index 14885df..be898f7 100644 (file)
@@ -4427,10 +4427,10 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                time64_t rtime = ns->ln_run_time_phase1 + duration;
 
                if (duration != 0)
-                       div_u64(new_checked, duration);
+                       new_checked = div64_s64(new_checked, duration);
 
                if (rtime != 0)
-                       div_u64(speed, rtime);
+                       speed = div64_s64(speed, rtime);
 
                lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0,
                                                bk->lb_param & LPF_DRYRUN);
@@ -4488,20 +4488,20 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                time64_t time0 = ns->ln_run_time_phase1 + rtime;
 
                if (duration != 0)
-                       div_u64(new_checked, duration);
+                       new_checked = div64_s64(new_checked, duration);
 
                if (ns->ln_run_time_phase1 != 0)
-                       div_u64(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)
-                       div_u64(speed2, rtime);
+                       speed2 = div64_s64(speed2, rtime);
                else if (checked != 0)
                        time0++;
 
                if (time0 != 0)
-                       div_u64(speed0, time0);
+                       speed0 = div64_s64(speed0, time0);
 
                lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked,
                                                checked,
@@ -4525,17 +4525,17 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                time64_t time0 = ns->ln_run_time_phase1 + ns->ln_run_time_phase2;
 
                if (ns->ln_run_time_phase1 != 0)
-                       div_u64(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)
-                       div_u64(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)
-                       div_u64(speed0, time0);
+                       speed0 = div64_s64(speed0, time0);
 
                lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked,
                                                ns->ln_objs_checked_phase2,
index 77588e9..ba5ad94 100644 (file)
@@ -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 \