static const char lfsck_namespace_name[] = "lfsck_namespace";
-static void lfsck_namespace_le_to_cpu(struct lfsck_namespace *des,
+static void lfsck_namespace_le_to_cpu(struct lfsck_namespace *dst,
struct lfsck_namespace *src)
{
- des->ln_magic = le32_to_cpu(src->ln_magic);
- des->ln_status = le32_to_cpu(src->ln_status);
- des->ln_flags = le32_to_cpu(src->ln_flags);
- des->ln_success_count = le32_to_cpu(src->ln_success_count);
- des->ln_run_time_phase1 = le32_to_cpu(src->ln_run_time_phase1);
- des->ln_run_time_phase2 = le32_to_cpu(src->ln_run_time_phase2);
- des->ln_time_last_complete = le64_to_cpu(src->ln_time_last_complete);
- des->ln_time_latest_start = le64_to_cpu(src->ln_time_latest_start);
- des->ln_time_last_checkpoint =
+ dst->ln_magic = le32_to_cpu(src->ln_magic);
+ dst->ln_status = le32_to_cpu(src->ln_status);
+ dst->ln_flags = le32_to_cpu(src->ln_flags);
+ dst->ln_success_count = le32_to_cpu(src->ln_success_count);
+ dst->ln_run_time_phase1 = le32_to_cpu(src->ln_run_time_phase1);
+ dst->ln_run_time_phase2 = le32_to_cpu(src->ln_run_time_phase2);
+ dst->ln_time_last_complete = le64_to_cpu(src->ln_time_last_complete);
+ dst->ln_time_latest_start = le64_to_cpu(src->ln_time_latest_start);
+ dst->ln_time_last_checkpoint =
le64_to_cpu(src->ln_time_last_checkpoint);
- lfsck_position_le_to_cpu(&des->ln_pos_latest_start,
+ lfsck_position_le_to_cpu(&dst->ln_pos_latest_start,
&src->ln_pos_latest_start);
- lfsck_position_le_to_cpu(&des->ln_pos_last_checkpoint,
+ lfsck_position_le_to_cpu(&dst->ln_pos_last_checkpoint,
&src->ln_pos_last_checkpoint);
- lfsck_position_le_to_cpu(&des->ln_pos_first_inconsistent,
+ lfsck_position_le_to_cpu(&dst->ln_pos_first_inconsistent,
&src->ln_pos_first_inconsistent);
- des->ln_items_checked = le64_to_cpu(src->ln_items_checked);
- des->ln_items_repaired = le64_to_cpu(src->ln_items_repaired);
- des->ln_items_failed = le64_to_cpu(src->ln_items_failed);
- des->ln_dirs_checked = le64_to_cpu(src->ln_dirs_checked);
- des->ln_mlinked_checked = le64_to_cpu(src->ln_mlinked_checked);
- des->ln_objs_checked_phase2 = le64_to_cpu(src->ln_objs_checked_phase2);
- des->ln_objs_repaired_phase2 =
+ dst->ln_items_checked = le64_to_cpu(src->ln_items_checked);
+ dst->ln_items_repaired = le64_to_cpu(src->ln_items_repaired);
+ dst->ln_items_failed = le64_to_cpu(src->ln_items_failed);
+ dst->ln_dirs_checked = le64_to_cpu(src->ln_dirs_checked);
+ dst->ln_mlinked_checked = le64_to_cpu(src->ln_mlinked_checked);
+ dst->ln_objs_checked_phase2 = le64_to_cpu(src->ln_objs_checked_phase2);
+ dst->ln_objs_repaired_phase2 =
le64_to_cpu(src->ln_objs_repaired_phase2);
- des->ln_objs_failed_phase2 = le64_to_cpu(src->ln_objs_failed_phase2);
- des->ln_objs_nlink_repaired = le64_to_cpu(src->ln_objs_nlink_repaired);
- des->ln_objs_lost_found = le64_to_cpu(src->ln_objs_lost_found);
- fid_le_to_cpu(&des->ln_fid_latest_scanned_phase2,
+ dst->ln_objs_failed_phase2 = le64_to_cpu(src->ln_objs_failed_phase2);
+ dst->ln_objs_nlink_repaired = le64_to_cpu(src->ln_objs_nlink_repaired);
+ dst->ln_objs_lost_found = le64_to_cpu(src->ln_objs_lost_found);
+ fid_le_to_cpu(&dst->ln_fid_latest_scanned_phase2,
&src->ln_fid_latest_scanned_phase2);
+ dst->ln_dirent_repaired = le64_to_cpu(src->ln_dirent_repaired);
+ dst->ln_linkea_repaired = le64_to_cpu(src->ln_linkea_repaired);
}
-static void lfsck_namespace_cpu_to_le(struct lfsck_namespace *des,
+static void lfsck_namespace_cpu_to_le(struct lfsck_namespace *dst,
struct lfsck_namespace *src)
{
- des->ln_magic = cpu_to_le32(src->ln_magic);
- des->ln_status = cpu_to_le32(src->ln_status);
- des->ln_flags = cpu_to_le32(src->ln_flags);
- des->ln_success_count = cpu_to_le32(src->ln_success_count);
- des->ln_run_time_phase1 = cpu_to_le32(src->ln_run_time_phase1);
- des->ln_run_time_phase2 = cpu_to_le32(src->ln_run_time_phase2);
- des->ln_time_last_complete = cpu_to_le64(src->ln_time_last_complete);
- des->ln_time_latest_start = cpu_to_le64(src->ln_time_latest_start);
- des->ln_time_last_checkpoint =
+ dst->ln_magic = cpu_to_le32(src->ln_magic);
+ dst->ln_status = cpu_to_le32(src->ln_status);
+ dst->ln_flags = cpu_to_le32(src->ln_flags);
+ dst->ln_success_count = cpu_to_le32(src->ln_success_count);
+ dst->ln_run_time_phase1 = cpu_to_le32(src->ln_run_time_phase1);
+ dst->ln_run_time_phase2 = cpu_to_le32(src->ln_run_time_phase2);
+ dst->ln_time_last_complete = cpu_to_le64(src->ln_time_last_complete);
+ dst->ln_time_latest_start = cpu_to_le64(src->ln_time_latest_start);
+ dst->ln_time_last_checkpoint =
cpu_to_le64(src->ln_time_last_checkpoint);
- lfsck_position_cpu_to_le(&des->ln_pos_latest_start,
+ lfsck_position_cpu_to_le(&dst->ln_pos_latest_start,
&src->ln_pos_latest_start);
- lfsck_position_cpu_to_le(&des->ln_pos_last_checkpoint,
+ lfsck_position_cpu_to_le(&dst->ln_pos_last_checkpoint,
&src->ln_pos_last_checkpoint);
- lfsck_position_cpu_to_le(&des->ln_pos_first_inconsistent,
+ lfsck_position_cpu_to_le(&dst->ln_pos_first_inconsistent,
&src->ln_pos_first_inconsistent);
- des->ln_items_checked = cpu_to_le64(src->ln_items_checked);
- des->ln_items_repaired = cpu_to_le64(src->ln_items_repaired);
- des->ln_items_failed = cpu_to_le64(src->ln_items_failed);
- des->ln_dirs_checked = cpu_to_le64(src->ln_dirs_checked);
- des->ln_mlinked_checked = cpu_to_le64(src->ln_mlinked_checked);
- des->ln_objs_checked_phase2 = cpu_to_le64(src->ln_objs_checked_phase2);
- des->ln_objs_repaired_phase2 =
+ dst->ln_items_checked = cpu_to_le64(src->ln_items_checked);
+ dst->ln_items_repaired = cpu_to_le64(src->ln_items_repaired);
+ dst->ln_items_failed = cpu_to_le64(src->ln_items_failed);
+ dst->ln_dirs_checked = cpu_to_le64(src->ln_dirs_checked);
+ dst->ln_mlinked_checked = cpu_to_le64(src->ln_mlinked_checked);
+ dst->ln_objs_checked_phase2 = cpu_to_le64(src->ln_objs_checked_phase2);
+ dst->ln_objs_repaired_phase2 =
cpu_to_le64(src->ln_objs_repaired_phase2);
- des->ln_objs_failed_phase2 = cpu_to_le64(src->ln_objs_failed_phase2);
- des->ln_objs_nlink_repaired = cpu_to_le64(src->ln_objs_nlink_repaired);
- des->ln_objs_lost_found = cpu_to_le64(src->ln_objs_lost_found);
- fid_cpu_to_le(&des->ln_fid_latest_scanned_phase2,
+ dst->ln_objs_failed_phase2 = cpu_to_le64(src->ln_objs_failed_phase2);
+ dst->ln_objs_nlink_repaired = cpu_to_le64(src->ln_objs_nlink_repaired);
+ dst->ln_objs_lost_found = cpu_to_le64(src->ln_objs_lost_found);
+ fid_cpu_to_le(&dst->ln_fid_latest_scanned_phase2,
&src->ln_fid_latest_scanned_phase2);
+ dst->ln_dirent_repaired = cpu_to_le64(src->ln_dirent_repaired);
+ dst->ln_linkea_repaired = cpu_to_le64(src->ln_linkea_repaired);
}
/**
int rc;
rc = lfsck_namespace_reset(env, com, false);
+ if (rc == 0)
+ rc = lfsck_set_param(env, lfsck, lsp->lsp_start, true);
+
if (rc != 0)
return rc;
}
if (ent->lde_attrs & LUDA_UPGRADE) {
ns->ln_flags |= LF_UPGRADE;
+ ns->ln_dirent_repaired++;
repaired = true;
} else if (ent->lde_attrs & LUDA_REPAIR) {
ns->ln_flags |= LF_INCONSISTENT;
+ ns->ln_dirent_repaired++;
repaired = true;
}
if (ent->lde_name[0] == '.' &&
(ent->lde_namelen == 1 ||
(ent->lde_namelen == 2 && ent->lde_name[1] == '.') ||
- fid_is_dot_lustre(&ent->lde_fid)))
+ fid_seq_is_dot_lustre(fid_seq(&ent->lde_fid))))
GOTO(out, rc = 0);
if (!(bk->lb_param & LPF_DRYRUN) &&
nodata:
if (bk->lb_param & LPF_DRYRUN) {
+ ns->ln_linkea_repaired++;
repaired = true;
goto record;
}
GOTO(stop, rc);
count = ldata.ld_leh->leh_reccount;
+ ns->ln_linkea_repaired++;
repaired = true;
} else {
GOTO(stop, rc);
"failed_phase2: "LPU64"\n"
"dirs: "LPU64"\n"
"M-linked: "LPU64"\n"
+ "dirent_repaired: "LPU64"\n"
+ "linkea_repaired: "LPU64"\n"
"nlinks_repaired: "LPU64"\n"
"lost_found: "LPU64"\n"
"success_count: %u\n"
ns->ln_objs_failed_phase2,
ns->ln_dirs_checked,
ns->ln_mlinked_checked,
+ ns->ln_dirent_repaired,
+ ns->ln_linkea_repaired,
ns->ln_objs_nlink_repaired,
ns->ln_objs_lost_found,
ns->ln_success_count,
"failed_phase2: "LPU64"\n"
"dirs: "LPU64"\n"
"M-linked: "LPU64"\n"
+ "dirent_repaired: "LPU64"\n"
+ "linkea_repaired: "LPU64"\n"
"nlinks_repaired: "LPU64"\n"
"lost_found: "LPU64"\n"
"success_count: %u\n"
ns->ln_objs_failed_phase2,
ns->ln_dirs_checked,
ns->ln_mlinked_checked,
+ ns->ln_dirent_repaired,
+ ns->ln_linkea_repaired,
ns->ln_objs_nlink_repaired,
ns->ln_objs_lost_found,
ns->ln_success_count,
"failed_phase2: "LPU64"\n"
"dirs: "LPU64"\n"
"M-linked: "LPU64"\n"
+ "dirent_repaired: "LPU64"\n"
+ "linkea_repaired: "LPU64"\n"
"nlinks_repaired: "LPU64"\n"
"lost_found: "LPU64"\n"
"success_count: %u\n"
ns->ln_objs_failed_phase2,
ns->ln_dirs_checked,
ns->ln_mlinked_checked,
+ ns->ln_dirent_repaired,
+ ns->ln_linkea_repaired,
ns->ln_objs_nlink_repaired,
ns->ln_objs_lost_found,
ns->ln_success_count,
out:
down_write(&com->lc_sem);
-
ns->ln_run_time_phase2 += cfs_duration_sec(cfs_time_current() +
HALF_SEC - lfsck->li_time_last_checkpoint);
ns->ln_time_last_checkpoint = cfs_time_current_sec();
ns->ln_status = LS_FAILED;
}
- if (ns->ln_status != LS_PAUSED) {
- spin_lock(&lfsck->li_lock);
- cfs_list_del_init(&com->lc_link);
- cfs_list_add_tail(&com->lc_link, &lfsck->li_list_idle);
- spin_unlock(&lfsck->li_lock);
- }
-
rc = lfsck_namespace_store(env, com, false);
-
up_write(&com->lc_sem);
if (atomic_dec_and_test(&lfsck->li_double_scan_count))
wake_up_all(&thread->t_ctl_waitq);