if (!page)
GOTO(cleanup, rc = -ENOMEM);
+ CDEBUG(D_INFO,"readpage %lu:%x for reset split"DFID" \n",
+ seg_end, seg_end, PFID(&rid));
rc = md_readpage(tgt_exp, &rid, NULL, seg_end, page, &tmp_req);
if (rc) {
/* E2BIG means it already reached the end of the dir,
kmap(page);
dp = cfs_page_address(page);
end = le32_to_cpu(dp->ldp_hash_end);
- if (end == ~0ul)
- rc = lmv_reset_hash_seg_end(lmv, obj, fid,
- i + 1, dp);
+ CDEBUG(D_INFO, "get "DFID" with end %lu i %d\n",
+ PFID(&rid), (unsigned long)end, i);
+ if (end == ~0ul) {
+ do {
+ rc = lmv_reset_hash_seg_end(lmv, obj, fid,
+ ++i, dp);
+ if (i >= obj->lo_objcount - 1)
+ break;
+ /* if there are no entries in this segment
+ * and it is not the last hash segment */
+ } while (rc != -E2BIG);
+ }
kunmap(page);
- } else
- if (rc == -ERANGE)
- rc = -EIO;
-
+ }
/*
* Here we could remove "." and ".." from all pages which at not from
* master. But MDS has only "." and ".." for master dir.
OBD_ALLOC_PTR(mdd_obj);
if (mdd_obj != NULL) {
struct lu_object *o;
-
+
o = mdd2lu_obj(mdd_obj);
lu_object_init(o, NULL, d);
mdd_obj->mod_obj.mo_ops = &mdd_obj_ops;
mdd_write_lock(env, mdd_obj);
rc = __mdd_object_create(env, mdd_obj, ma, handle);
- if (rc == 0 && spec->sp_cr_flags & MDS_CREATE_SLAVE_OBJ) {
+ if (rc)
+ GOTO (unlock, rc);
+
+ if (spec->sp_cr_flags & MDS_CREATE_SLAVE_OBJ) {
/* if creating the slave object, set slave EA here */
+ int lmv_size = spec->u.sp_ea.eadatalen;
+ struct lmv_stripe_md *lmv;
+
+ lmv = (struct lmv_stripe_md *)spec->u.sp_ea.eadata;
+ LASSERT(lmv != NULL && lmv_size > 0);
rc = __mdd_xattr_set(env, mdd_obj,
- mdd_buf_get_const(env,
- spec->u.sp_ea.eadata,
- spec->u.sp_ea.eadatalen),
+ mdd_buf_get_const(env, lmv, lmv_size),
MDS_LMV_MD_NAME, 0, handle);
+ if (rc)
+ GOTO(unlock, rc);
pfid = spec->u.sp_ea.fid;
- CWARN("set slave ea "DFID" eadatalen %d rc %d \n",
+ CWARN("set slave ea "DFID" eadatalen %d rc %d\n",
PFID(mdo2fid(mdd_obj)), spec->u.sp_ea.eadatalen, rc);
- }
-
- if (rc == 0)
+ rc = mdd_attr_set_internal(env, mdd_obj, &ma->ma_attr, handle);
+ } else
rc = __mdd_object_initialize(env, pfid, mdd_obj, ma, handle);
+unlock:
mdd_write_unlock(env, mdd_obj);
-
if (rc == 0)
rc = mdd_attr_get_internal_locked(env, mdd_obj, ma);