struct lfsck_bookmark *bk = &lfsck->ml_bookmark_ram;
struct lfsck_namespace *ns =
(struct lfsck_namespace *)com->lc_file_ram;
- struct mdd_link_data ldata = { 0 };
+ struct linkea_data ldata = { 0 };
struct thandle *handle = NULL;
bool locked = false;
bool update = false;
if (IS_ERR(handle))
RETURN(rc = PTR_ERR(handle));
- rc = mdd_declare_links_add(env, child, handle);;
+ rc = mdd_declare_links_add(env, child, handle, NULL);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- ldata.ml_lee = (struct link_ea_entry *)(ldata.ml_leh + 1);
- count = ldata.ml_leh->leh_reccount;
+ ldata.ld_lee = LINKEA_FIRST_ENTRY(ldata);
+ count = ldata.ld_leh->leh_reccount;
while (count-- > 0) {
struct mdd_object *parent = NULL;
struct dt_object *dir;
- mdd_lee_unpack(ldata.ml_lee, &ldata.ml_reclen, cname, pfid);
+ linkea_entry_unpack(ldata.ld_lee, &ldata.ld_reclen, cname,
+ pfid);
if (!fid_is_sane(pfid))
goto shrink;
/* XXX: need more processing for remote object in the future. */
if (mdd_object_remote(parent)) {
mdd_object_put(env, parent);
- ldata.ml_lee = (struct link_ea_entry *)
- ((char *)ldata.ml_lee + ldata.ml_reclen);
+ ldata.ld_lee = LINKEA_NEXT_ENTRY(ldata);
continue;
}
if (rc == 0) {
if (lu_fid_eq(cfid, mdo2fid(child))) {
mdd_object_put(env, parent);
- ldata.ml_lee = (struct link_ea_entry *)
- ((char *)ldata.ml_lee + ldata.ml_reclen);
+ ldata.ld_lee = LINKEA_NEXT_ENTRY(ldata);
continue;
}
goto shrink;
}
- if (ldata.ml_leh->leh_reccount > la->la_nlink)
+ if (ldata.ld_leh->leh_reccount > la->la_nlink)
goto shrink;
/* XXX: For the case of there is linkea entry, but without name
* It is out of LFSCK 1.5 scope, will implement it in the
* future. Keep the linkEA entry. */
mdd_object_put(env, parent);
- ldata.ml_lee = (struct link_ea_entry *)
- ((char *)ldata.ml_lee + ldata.ml_reclen);
+ ldata.ld_lee = LINKEA_NEXT_ENTRY(ldata);
continue;
shrink:
CDEBUG(D_LFSCK, "Remove linkEA: "DFID"[%.*s], "DFID"\n",
PFID(mdo2fid(child)), cname->ln_namelen, cname->ln_name,
PFID(pfid));
- mdd_links_del_buf(env, &ldata, cname);
+ linkea_del_buf(&ldata, cname);
update = true;
}
return rc;
/* For insert new linkEA entry. */
- rc = mdd_declare_links_add(env, obj, handle);
+ rc = mdd_declare_links_add(env, obj, handle, NULL);
return rc;
}
struct lfsck_namespace *ns =
(struct lfsck_namespace *)com->lc_file_ram;
struct mdd_device *mdd = mdd_lfsck2mdd(lfsck);
- struct mdd_link_data ldata = { 0 };
+ struct linkea_data ldata = { 0 };
const struct lu_fid *pfid =
lu_object_fid(&lfsck->ml_obj_dir->do_lu);
const struct lu_fid *cfid = mdo2fid(obj);
rc = mdd_links_read(env, obj, &ldata);
if (rc == 0) {
- count = ldata.ml_leh->leh_reccount;
- rc = mdd_links_find(env, obj, &ldata, cname, pfid);
+ count = ldata.ld_leh->leh_reccount;
+ rc = linkea_links_find(&ldata, cname, pfid);
if (rc == 0) {
/* For dir, if there are more than one linkea entries,
* then remove all the other redundant linkea entries.*/
}
nodata:
- rc = mdd_links_new(env, &ldata);
+ rc = linkea_data_new(&ldata, &mdd_env_info(env)->mti_link_buf);
if (rc != 0)
GOTO(stop, rc);
if (!com->lc_journal)
goto again;
- rc = mdd_links_add_buf(env, &ldata, cname, pfid);
+ rc = linkea_add_buf(&ldata, cname, pfid);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- count = ldata.ml_leh->leh_reccount;
+ count = ldata.ld_leh->leh_reccount;
repaired = true;
} else {
GOTO(stop, rc);
else if (IS_ERR(obj))
return PTR_ERR(obj);
- /* XXX: need more processing for remote object in the future. */
- if (!mdd_object_exists(obj) || mdd_object_remote(obj)) {
+ if (!mdd_object_exists(obj)) {
mdd_object_put(env, obj);
return 0;
}
+ /* Currently, only client visible directory can be remote. */
+ if (mdd_object_remote(obj)) {
+ mdd_object_put(env, obj);
+ return 1;
+ }
+
depth++;
}
return 0;
/* Init otable-based iterator. */
if (pos == NULL) {
rc = iops->load(env, lfsck->ml_di_oit, 0);
- GOTO(out, rc = (rc >= 0 ? 0 : rc));
+ if (rc > 0) {
+ lfsck->ml_oit_over = 1;
+ rc = 0;
+ }
+
+ GOTO(out, rc);
}
rc = iops->load(env, lfsck->ml_di_oit, pos->lp_oit_cookie);
if (rc < 0)
GOTO(out, rc);
+ else if (rc > 0)
+ lfsck->ml_oit_over = 1;
if (fid_is_zero(&pos->lp_dir_parent))
GOTO(out, rc = 0);
struct l_wait_info lwi = { 0 };
ENTRY;
+ if (!lfsck->ml_initialized)
+ RETURN(0);
+
mutex_lock(&lfsck->ml_mutex);
spin_lock(&lfsck->ml_lock);
if (thread_is_init(thread) || thread_is_stopped(thread)) {