if (IS_ERR(dto))
GOTO(out, rc = PTR_ERR(dto));
+ com->lc_obj = dto;
rc = dto->do_ops->do_index_try(env, dto, &dt_lfsck_features);
if (rc != 0)
GOTO(out, rc);
- com->lc_obj = dto;
rc = lfsck_namespace_store(env, com, true);
GOTO(out, rc);
if (ns->ln_status == LS_SCANNING_PHASE1) {
struct lfsck_position pos;
+ const struct dt_it_ops *iops;
cfs_duration_t duration = cfs_time_current() -
lfsck->li_time_last_checkpoint;
__u64 checked = ns->ln_items_checked + com->lc_new_checked;
buf += rc;
len -= rc;
- lfsck_pos_fill(env, lfsck, &pos, false);
+
+ LASSERT(lfsck->li_di_oit != NULL);
+
+ iops = &lfsck->li_obj_oit->do_index_ops->dio_it;
+
+ /* The low layer otable-based iteration position may NOT
+ * exactly match the namespace-based directory traversal
+ * cookie. Generally, it is not a serious issue. But the
+ * caller should NOT make assumption on that. */
+ pos.lp_oit_cookie = iops->store(env, lfsck->li_di_oit);
+ if (!lfsck->li_current_oit_processed)
+ pos.lp_oit_cookie--;
+
+ spin_lock(&lfsck->li_lock);
+ if (lfsck->li_di_dir != NULL) {
+ pos.lp_dir_cookie = lfsck->li_cookie_dir;
+ if (pos.lp_dir_cookie >= MDS_DIR_END_OFF) {
+ fid_zero(&pos.lp_dir_parent);
+ pos.lp_dir_cookie = 0;
+ } else {
+ pos.lp_dir_parent =
+ *lu_object_fid(&lfsck->li_obj_dir->do_lu);
+ }
+ } else {
+ fid_zero(&pos.lp_dir_parent);
+ pos.lp_dir_cookie = 0;
+ }
+ spin_unlock(&lfsck->li_lock);
rc = lfsck_pos_dump(&buf, &len, &pos, "current_position");
if (rc <= 0)
goto out;