* \param[in] env execution environment.
* \param[in] dt the striped directory object to be iterated.
* \param[in] attr the attribute of iterator, mostly used to indicate
- * the entry attribute in the object to be iterated.
+ * the entry attribute in the object to be iterated.
* \param[in] capa capability(useless in current implementation)
*
* \retval initialized iterator(dt_it) if successful initialize the
- * iteration. lit_stripe_index will be used to indicate the
- * current iterate position among stripes.
+ * iteration. lit_stripe_index will be used to indicate the
+ * current iterate position among stripes.
* \retval ERR pointer if initialization is failed.
*/
static struct dt_it *lod_striped_it_init(const struct lu_env *env,
* \param[in] env execution environment.
* \param[in] di the iterator for striped directory.
* \param[in] attr the attribute of iterator, mostly used to indicate
- * the entry attribute in the object to be iterated.
+ * the entry attribute in the object to be iterated.
* \param[out] rec hold the return record.
*
* \retval 0 if successfully get the entry.
* \param[in] env execution environment.
* \param[in] di the iterator for striped directory.
* \param[in] attr the attribute of iterator, mostly used to indicate
- * the entry attribute in the object to be iterated.
+ * the entry attribute in the object to be iterated.
*
* \retval rec_size if successfully get the entry size.
* \retval negative error if can not get entry size.
*/
LASSERT(lo->ldo_stripe);
for (i = 0; i < lo->ldo_stripenr; i++) {
- LASSERT(lo->ldo_stripe[i]);
-
- rc = dt_declare_attr_set(env, lo->ldo_stripe[i], attr, handle);
- if (rc) {
- CERROR("failed declaration: %d\n", rc);
- break;
+ if (likely(lo->ldo_stripe[i] != NULL)) {
+ rc = dt_declare_attr_set(env, lo->ldo_stripe[i], attr,
+ handle);
+ if (rc != 0) {
+ CERROR("failed declaration: %d\n", rc);
+ break;
+ }
}
}
*/
LASSERT(lo->ldo_stripe);
for (i = 0; i < lo->ldo_stripenr; i++) {
- LASSERT(lo->ldo_stripe[i]);
- if (dt_object_exists(lo->ldo_stripe[i]) == 0)
- continue;
- rc = dt_attr_set(env, lo->ldo_stripe[i], attr, handle, capa);
- if (rc) {
- CERROR("failed declaration: %d\n", rc);
- break;
+ if (likely(lo->ldo_stripe[i] != NULL)) {
+ if (dt_object_exists(lo->ldo_stripe[i]) == 0)
+ continue;
+
+ rc = dt_attr_set(env, lo->ldo_stripe[i], attr,
+ handle, capa);
+ if (rc != 0) {
+ CERROR("failed declaration: %d\n", rc);
+ break;
+ }
}
}
LASSERT(buf != NULL && buf->lb_buf != NULL);
lum = buf->lb_buf;
- rc = lod_verify_striping(d, buf, 0);
+ rc = lod_verify_striping(d, buf, false);
if (rc)
RETURN(rc);
rc = 0;
v1 = info->lti_ea_store;
- if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V1))
+ if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V1)) {
lustre_swab_lov_user_md_v1(v1);
- else if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V3))
+ } else if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V3)) {
+ v3 = (struct lov_user_md_v3 *)v1;
lustre_swab_lov_user_md_v3(v3);
+ }
if (v1->lmm_magic != LOV_MAGIC_V3 && v1->lmm_magic != LOV_MAGIC_V1)
GOTO(unlock, rc = 0);
if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MDTOBJ))
RETURN(0);
- /* declare destroy for all underlying objects */
+ /* declare destroy all striped objects */
for (i = 0; i < lo->ldo_stripenr; i++) {
- LASSERT(lo->ldo_stripe[i]);
- rc = dt_declare_destroy(env, lo->ldo_stripe[i], th);
- if (rc != 0)
- break;
+ if (likely(lo->ldo_stripe[i] != NULL)) {
+ rc = dt_declare_destroy(env, lo->ldo_stripe[i], th);
+ if (rc != 0)
+ break;
+ }
}
RETURN(rc);
/* destroy all striped objects */
for (i = 0; i < lo->ldo_stripenr; i++) {
- LASSERT(lo->ldo_stripe[i]);
- rc = dt_destroy(env, lo->ldo_stripe[i], th);
- if (rc != 0)
- break;
+ if (likely(lo->ldo_stripe[i] != NULL) &&
+ (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
+ i == cfs_fail_val)) {
+ rc = dt_destroy(env, lo->ldo_stripe[i], th);
+ if (rc != 0)
+ break;
+ }
}
RETURN(rc);