#define LFSCK_RBTREE_BITMAP_SIZE PAGE_CACHE_SIZE
#define LFSCK_RBTREE_BITMAP_WIDTH (LFSCK_RBTREE_BITMAP_SIZE << 3)
-#define LFSCK_RBTREE_BITMAP_MASK (LFSCK_RBTREE_BITMAP_SIZE - 1)
+#define LFSCK_RBTREE_BITMAP_MASK (LFSCK_RBTREE_BITMAP_WIDTH - 1)
struct lfsck_rbtree_node {
struct rb_node lrn_node;
if (oid < lrn->lrn_first_oid)
return -1;
- if (oid >= lrn->lrn_first_oid + LFSCK_RBTREE_BITMAP_WIDTH)
+ if (oid - lrn->lrn_first_oid >= LFSCK_RBTREE_BITMAP_WIDTH)
return 1;
return 0;
lfsck_rbtree_insert(struct lfsck_layout_slave_data *llsd,
struct lfsck_rbtree_node *lrn)
{
- struct rb_node **pos = &(llsd->llsd_rb_root.rb_node);
+ struct rb_node **pos = &llsd->llsd_rb_root.rb_node;
struct rb_node *parent = NULL;
struct lfsck_rbtree_node *tmp;
int rc;
- while (*pos) {
+ while (*pos != NULL) {
parent = *pos;
- tmp = rb_entry(*pos, struct lfsck_rbtree_node, lrn_node);
+ tmp = rb_entry(parent, struct lfsck_rbtree_node, lrn_node);
rc = lfsck_rbtree_cmp(tmp, lrn->lrn_seq, lrn->lrn_first_oid);
if (rc < 0)
- pos = &((*pos)->rb_left);
+ pos = &(*pos)->rb_left;
else if (rc > 0)
- pos = &((*pos)->rb_right);
+ pos = &(*pos)->rb_right;
else
return tmp;
}
const struct dt_it_ops *iops;
cfs_duration_t duration = cfs_time_current() -
lfsck->li_time_last_checkpoint;
- __u64 checked = lo->ll_objs_checked_phase1 + com->lc_new_checked;
+ __u64 checked = lo->ll_objs_checked_phase1 +
+ com->lc_new_checked;
__u64 speed = checked;
__u64 new_checked = com->lc_new_checked * HZ;
__u32 rtime = lo->ll_run_time_phase1 +
} else if (lo->ll_status == LS_SCANNING_PHASE2) {
cfs_duration_t duration = cfs_time_current() -
lfsck->li_time_last_checkpoint;
- __u64 checked = lo->ll_objs_checked_phase1 + com->lc_new_checked;
- __u64 speed = checked;
+ __u64 checked = lo->ll_objs_checked_phase2 +
+ com->lc_new_checked;
+ __u64 speed1 = lo->ll_objs_checked_phase1;
+ __u64 speed2 = checked;
__u64 new_checked = com->lc_new_checked * HZ;
- __u32 rtime = lo->ll_run_time_phase1 +
+ __u32 rtime = lo->ll_run_time_phase2 +
cfs_duration_sec(duration + HALF_SEC);
if (duration != 0)
do_div(new_checked, duration);
+ if (lo->ll_run_time_phase1 != 0)
+ do_div(speed1, lo->ll_run_time_phase1);
if (rtime != 0)
- do_div(speed, rtime);
+ do_div(speed2, rtime);
rc = snprintf(buf, len,
"checked_phase1: "LPU64"\n"
"checked_phase2: "LPU64"\n"
"run_time_phase1: %u seconds\n"
"run_time_phase2: %u seconds\n"
"average_speed_phase1: "LPU64" items/sec\n"
- "average_speed_phase2: N/A\n"
- "real-time_speed_phase1: "LPU64" items/sec\n"
- "real-time_speed_phase2: N/A\n"
+ "average_speed_phase2: "LPU64" items/sec\n"
+ "real-time_speed_phase1: N/A\n"
+ "real-time_speed_phase2: "LPU64" items/sec\n"
"current_position: "DFID"\n",
+ lo->ll_objs_checked_phase1,
checked,
- lo->ll_objs_checked_phase2,
+ lo->ll_run_time_phase1,
rtime,
- lo->ll_run_time_phase2,
- speed,
+ speed1,
+ speed2,
new_checked,
PFID(&com->lc_fid_latest_scanned_phase2));
if (rc <= 0)