struct lfsck_assistant_req *lar)
{
struct lfsck_namespace_req *lnr =
- container_of0(lar, struct lfsck_namespace_req, lnr_lar);
+ container_of(lar, struct lfsck_namespace_req, lnr_lar);
if (lnr->lnr_lmv != NULL)
lfsck_lmv_put(env, lnr->lnr_lmv);
if (unlikely(lfsck_is_dead_obj(obj)))
RETURN(LFSCK_NAMEENTRY_DEAD);
- rc = dt_lookup(env, dir, (struct dt_rec *)fid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, dir, name, fid);
if (rc == -ENOENT)
RETURN(LFSCK_NAMEENTRY_REMOVED);
do {
namelen = snprintf(info->lti_key, NAME_MAX, DFID"%s-%s-%d",
PFID(cfid), infix, type, idx++);
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)info->lti_key);
+ rc = dt_lookup_dir(env, parent, info->lti_key, &tfid);
if (rc != 0 && rc != -ENOENT)
GOTO(log, rc);
/* Re-check whether the name conflict with othrs after taken
* the ldlm lock. */
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)info->lti_key);
+ rc = dt_lookup_dir(env, parent, info->lti_key, &tfid);
if (rc == 0) {
if (!lu_fid_eq(cfid, &tfid)) {
exist = false;
if (IS_ERR(th))
RETURN(PTR_ERR(th));
- rc = dt_declare_xattr_set(env, obj, &buf, XATTR_NAME_LMV".set", 0, th);
+ rc = dt_declare_xattr_set(env, obj, &buf, XATTR_NAME_LMV, 0, th);
if (rc)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- rc = dt_xattr_set(env, obj, &buf, XATTR_NAME_LMV".set", 0, th);
+ rc = dt_xattr_set(env, obj, &buf, XATTR_NAME_LMV, 0, th);
if (rc)
GOTO(stop, rc);
}
if (parent_lmv_lost) {
- rc = dt_declare_xattr_set(env, parent, &buf,
- XATTR_NAME_LMV".set", 0, th);
+ rc = dt_declare_xattr_set(env, parent, &buf, XATTR_NAME_LMV,
+ 0, th);
if (rc)
GOTO(stop, rc);
}
}
if (parent_lmv_lost) {
- rc = dt_xattr_set(env, parent, &buf, XATTR_NAME_LMV".set", 0,
- th);
+ rc = dt_xattr_set(env, parent, &buf, XATTR_NAME_LMV, 0, th);
if (rc)
GOTO(stop, rc);
}
GOTO(log, rc = idx);
snprintf(name, 8, "MDT%04x", idx);
- rc = dt_lookup(env, lfsck->li_lpf_root_obj,
- (struct dt_rec *)&tfid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, lfsck->li_lpf_root_obj, name, &tfid);
if (rc != 0)
GOTO(log, rc = (rc == -ENOENT ? -ENXIO : rc));
do {
namelen = snprintf(name, 31, DFID"-P-%d",
PFID(cfid), idx++);
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, parent, name, &tfid);
if (rc != 0 && rc != -ENOENT)
GOTO(log, rc);
} while (rc == 0);
/* Re-check whether the name conflict with othrs after taken
* the ldlm lock. */
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, parent, name, &tfid);
if (unlikely(rc == 0)) {
lfsck_unlock(llh);
goto again;
lmv->lmv_master_mdt_index = lfsck_dev_idx(lfsck);
lfsck_lmv_header_cpu_to_le(lmv2, lmv);
lfsck_buf_init(&lmv_buf, lmv2, sizeof(*lmv2));
- rc = dt_declare_xattr_set(env, orphan, &lmv_buf,
- XATTR_NAME_LMV, 0, th);
+ rc = dt_declare_xattr_set(env, orphan, &lmv_buf, XATTR_NAME_LMV,
+ 0, th);
if (rc != 0)
GOTO(stop, rc);
}
goto replace;
}
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, parent, name, &tfid);
if (rc == -ENOENT) {
exist = false;
goto replace;
dt_write_lock(env, parent, 0);
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)name);
+ rc = dt_lookup_dir(env, dt_object_child(parent), name, &tfid);
/* Someone has removed the bad name entry by race. */
if (rc == -ENOENT)
GOTO(unlock2, rc = 0);
GOTO(out, rc);
}
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)cname->ln_name);
+ rc = dt_lookup_dir(env, parent, cname->ln_name, &tfid);
if (rc == -ENOENT) {
/* If the LFSCK is marked as LF_INCOMPLETE, then means some MDT
* has ever tried to verify some remote MDT-object that resides
continue;
}
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
- (const struct dt_key *)cname->ln_name);
+ rc = dt_lookup_dir(env, parent, cname->ln_name, &tfid);
*pfid2 = *lfsck_dto2fid(parent);
if (rc == -ENOENT) {
lfsck_object_put(env, parent);
GOTO(out, rc = 0);
}
- rc = dt_lookup(env, child, (struct dt_rec *)pfid,
- (const struct dt_key *)dotdot);
+ rc = dt_lookup_dir(env, child, dotdot, pfid);
if (rc != 0) {
if (rc != -ENOENT && rc != -ENODATA && rc != -EINVAL) {
dt_read_unlock(env, child);
continue;
}
- rc = dt_lookup(env, parent, (struct dt_rec *)cfid,
- (const struct dt_key *)cname->ln_name);
+ rc = dt_lookup_dir(env, parent, cname->ln_name, cfid);
if (rc != 0 && rc != -ENOENT) {
lfsck_object_put(env, parent);
return rc;
}
-static struct lfsck_operations lfsck_namespace_ops = {
+static const struct lfsck_operations lfsck_namespace_ops = {
.lfsck_reset = lfsck_namespace_reset,
.lfsck_fail = lfsck_namespace_fail,
.lfsck_close_dir = lfsck_namespace_close_dir,
*/
if (S_ISREG(type))
child->do_ops->do_ah_init(env, hint, parent, child, type);
+ else if (S_ISDIR(type))
+ child->do_ops->do_ah_init(env, hint, NULL, child, type);
memset(dof, 0, sizeof(*dof));
dof->dof_type = dt_mode_to_dft(type);
lfsck_lmv_header_cpu_to_le(lmv2, lmv2);
lfsck_buf_init(&lmv_buf, lmv2, sizeof(*lmv2));
rc = dt_declare_xattr_set(env, child, &lmv_buf,
- XATTR_NAME_LMV".set", 0, th);
+ XATTR_NAME_LMV, 0, th);
if (rc != 0)
GOTO(stop, rc);
}
/* 5b. generate slave LMV EA. */
if (lnr->lnr_lmv != NULL && lnr->lnr_lmv->ll_lmv_master) {
- rc = dt_xattr_set(env, child, &lmv_buf,
- XATTR_NAME_LMV".set", 0, th);
+ rc = dt_xattr_set(env, child, &lmv_buf, XATTR_NAME_LMV,
+ 0, th);
if (rc != 0)
GOTO(unlock, rc);
}
const struct lu_name *cname;
struct thandle *handle = NULL;
struct lfsck_namespace_req *lnr =
- container_of0(lar, struct lfsck_namespace_req, lnr_lar);
+ container_of(lar, struct lfsck_namespace_req, lnr_lar);
struct dt_object *dir = NULL;
struct dt_object *obj = NULL;
struct lfsck_assistant_object *lso = lar->lar_parent;
repaired = true;
}
- if (unlikely(fid_is_zero(&lnr->lnr_fid))) {
- if (strcmp(lnr->lnr_name, dotdot) != 0)
- LBUG();
- else
- rc = lfsck_namespace_trace_update(env, com, pfid,
+ if (unlikely(fid_is_zero(&lnr->lnr_fid) &&
+ strcmp(lnr->lnr_name, dotdot) == 0)) {
+ rc = lfsck_namespace_trace_update(env, com, pfid,
LNTF_CHECK_PARENT, true);
GOTO(out, rc);
EXIT;
}
-struct lfsck_assistant_operations lfsck_namespace_assistant_ops = {
+const struct lfsck_assistant_operations lfsck_namespace_assistant_ops = {
.la_handler_p1 = lfsck_namespace_assistant_handler_p1,
.la_handler_p2 = lfsck_namespace_assistant_handler_p2,
.la_fill_pos = lfsck_namespace_assistant_fill_pos,