if (atomic_dec_and_test(&lock->l_refc)) {
struct ldlm_resource *res;
- LDLM_DEBUG(lock, "final lock_put on destroyed lock, freeing it.");
+ LDLM_DEBUG(lock,
+ "final lock_put on destroyed lock, freeing it.\n");
lock_res_and_lock(lock);
res = lock->l_resource;
/* we got LOOKUP lock, but we really need attrs */
pmode = it->d.lustre.it_lock_mode;
if (pmode) {
- memcpy(&plock, &it->d.lustre.it_lock_handle, sizeof(plock));
+ plock.cookie = it->d.lustre.it_lock_handle;
it->d.lustre.it_lock_mode = 0;
it->d.lustre.it_data = 0;
}
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
GOTO(out, rc = -ENOMEM);
-
+
op_data->fid1 = body->fid1;
tgt_exp = lmv_get_export(lmv, &body->fid1);
*/
if (rc == 0) {
lmv_drop_intent_lock(it);
- memcpy(&it->d.lustre.it_lock_handle, &plock, sizeof(plock));
+ it->d.lustre.it_lock_handle = plock.cookie;
it->d.lustre.it_lock_mode = pmode;
}
rc = lmv_fld_lookup(lmv, rpid, &mds);
if (rc)
GOTO(cleanup, rc);
-
+
rc = obd_fid_alloc(lmv->tgts[mds].ltd_exp, fid, NULL);
if (rc < 0)
GOTO(cleanup, rc);
OBD_ALLOC_PTR(sop_data);
if (sop_data == NULL)
RETURN(-ENOMEM);
-
+
/* save op_data fro repeat case */
*sop_data = *op_data;
-
+
repeat:
LASSERT(++loop <= 2);
rc = lmv_fld_lookup(lmv, &rpid, &mds);
if (rc)
GOTO(out_free_sop_data, rc);
-
+
obj = lmv_obj_grab(obd, &rpid);
if (obj) {
/*
rpid = obj->lo_inodes[mds].li_fid;
rc = lmv_fld_lookup(lmv, &rpid, &mds);
lmv_obj_put(obj);
- if (rc)
+ if (rc)
GOTO(out_free_sop_data, rc);
-
+
CDEBUG(D_OTHER, "forward to MDS #"LPU64" ("DFID")\n",
mds, PFID(&rpid));
}
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, sop_data,
lmm, lmmsize, it, flags, reqp,
cb_blocking, extra_lock_flags);
-
+
if (rc == -ERESTART) {
/*
* Directory got split. Time to update local object and repeat
OBD_ALLOC_PTR(sop_data);
if (sop_data == NULL)
RETURN(-ENOMEM);
-
+
/* save op_data fro repeat case */
*sop_data = *op_data;
-
+
if (fid_is_sane(&op_data->fid2)) {
/*
* Caller wants to revalidate attrs of obj we have to revalidate
*/
CDEBUG(D_OTHER, "revalidate attrs for "DFID"\n",
PFID(&op_data->fid2));
-
+
rc = lmv_fld_lookup(lmv, &op_data->fid2, &mds);
if (rc)
GOTO(out_free_sop_data, rc);
CDEBUG(D_OTHER, "INTENT getattr for %*s on "DFID"\n",
op_data->namelen, op_data->name,
PFID(&op_data->fid1));
-
+
rc = lmv_fld_lookup(lmv, &op_data->fid1, &mds);
if (rc)
GOTO(out_free_sop_data, rc);
mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
(char *)op_data->name,
op_data->namelen);
-
+
rpid = obj->lo_inodes[mds].li_fid;
rc = lmv_fld_lookup(lmv, &rpid, &mds);
if (rc) {
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
RETURN(-ENOMEM);
-
+
lmv_obj_lock(obj);
for (i = 0; i < obj->lo_objcount; i++) {
OBD_ALLOC_PTR(sop_data);
if (sop_data == NULL)
RETURN(-ENOMEM);
-
+
/* save op_data fro repeat case */
*sop_data = *op_data;
-
+
/*
* IT_LOOKUP is intended to produce name -> fid resolving (let's call
* this lookup below) or to confirm requested resolving is still valid
LASSERT(it != NULL);
LASSERT(fid_is_sane(&op_data->fid1));
-
+
CDEBUG(D_OTHER, "INTENT LOCK '%s' for '%*s' on "DFID"\n",
LL_IT2STR(it), op_data->namelen, op_data->name,
PFID(&op_data->fid1));
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
RETURN(-ENOMEM);
-
+
/* we have to loop over the subobjects, check validity and update them
* from MDSs if needed. it's very useful that we need not to update all
* the fields. say, common fields (that are equal on all the subojects
/* it even got the reply refresh attrs
* from that reply */
body = lustre_msg_buf(mreq->rq_repmsg,
- DLM_REPLY_REC_OFF,
+ DLM_REPLY_REC_OFF,
sizeof(*body));
LASSERT(body != NULL);
goto update;
rc = md_intent_lock(tgt_exp, op_data, NULL, 0, &it, 0, &req, cb,
extra_lock_flags);
-
+
lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
if (rc > 0 && req == NULL) {
/* nice, this slave is valid */
LASSERT(body);
update:
- obj->lo_inodes[i].li_size = (MAX_HASH_SIZE/obj->lo_objcount) *
+ obj->lo_inodes[i].li_size = (MAX_HASH_SIZE/obj->lo_objcount) *
(i + 1);
CDEBUG(D_OTHER, "fresh: %lu\n",
CDEBUG(D_OTHER, "return refreshed attrs: size = %lu\n",
(unsigned long)size);
- body = lustre_msg_buf((*reqp)->rq_repmsg,
+ body = lustre_msg_buf((*reqp)->rq_repmsg,
DLM_REPLY_REC_OFF, sizeof(*body));
LASSERT(body);
* no reply and the only attr we can return is size.
*/
body->valid = OBD_MD_FLSIZE;
-
+
#if 0
rc = lmv_fld_lookup(lmv, &obj->lo_fid, &body->mds);
if (rc)
m = (struct mdd_object *)o;
else {
o = lu_object_locate(o->lo_header, mdd2lu_dev(d)->ld_type);
- m = o ? lu2mdd_obj(o) : NULL;
+ m = lu2mdd_obj(o);
}
RETURN(m);
}
{
struct mdd_device *mdd = cookie;
struct obd_device *obd = mdd2obd_dev(mdd);
-
+
return mds_lov_write_objids(obd);
}
struct lu_device *next = &mdd->mdd_child->dd_lu_dev;
dt_txn_callback_del(mdd->mdd_child, &mdd->mdd_txn_cb);
-
+
return next;
}
obd->obd_type->typ_dt_ops->o_postrecov(obd);
/* TODO: orphans handling */
rc = next->ld_ops->ldo_recovery_complete(ctxt, next);
-
+
RETURN(rc);
}
(mode & S_IALLUGO) | (tmp_la->la_mode & ~S_IALLUGO);
}
- /* For the "Size-on-MDS" setattr update, merge coming attributes with
+ /* For the "Size-on-MDS" setattr update, merge coming attributes with
* the set in the inode. */
if (la->la_valid & LA_SIZE) {
if ((la->la_valid & LA_ATIME) &&
(la->la_atime < tmp_la->la_atime))
la->la_valid &= ~LA_ATIME;
-
- if ((la->la_valid & LA_CTIME) &&
+
+ if ((la->la_valid & LA_CTIME) &&
(la->la_ctime < tmp_la->la_ctime))
la->la_valid &= ~(LA_MTIME | LA_CTIME);
}
-
+
RETURN(rc);
}
* sucess, we should return -ERESTART to notify the
* client, so transno for this splitting should be
* zero according to the replay rules. so return -ERESTART
- * here let mdt trans stop callback know this.
+ * here let mdt trans stop callback know this.
*/
if (strncmp(name, MDS_LMV_MD_NAME, strlen(name)) == 0)
rc = -ERESTART;
/* Do not lookup ".." in root, they do not exist there. */
if (lu_fid_eq(mdo2fid(p1), &mdd->mdd_root_fid))
RETURN(0);
-
+
for(;;) {
rc = mdd_parent_fid(ctxt, p1, pfid);
if (rc)
if (parent)
mdd_object_put(ctxt, parent);
parent = mdd_object_find(ctxt, mdd, pfid);
-
+
/* cross-ref parent, not supported yet */
if (parent == NULL) {
if (pf != NULL)
mdd_write_lock(ctxt, src_pobj);
RETURN(0);
}
-
+
/* compared the parent child relationship of src_p&tgt_p */
if (lu_fid_eq(&mdd->mdd_root_fid, mdo2fid(src_pobj))){
mdd_lock2(ctxt, src_pobj, tgt_pobj);
LASSERT(ma->ma_attr.la_mode & S_IFMT);
is_dir = S_ISDIR(ma->ma_attr.la_mode);
-
if (ma->ma_attr.la_valid & LA_FLAGS &&
ma->ma_attr.la_flags & (LUSTRE_APPEND_FL | LUSTRE_IMMUTABLE_FL))
RETURN(-EPERM);
* so we do index_delete unconditionally and -ENOENT is allowed */
if (rc != 0 && rc != -ENOENT)
GOTO(cleanup, rc);
-
+
rc = __mdd_index_insert(ctxt, mdd_tpobj, lf, tname, is_dir, handle);
if (rc)
GOTO(cleanup, rc);
struct mdd_device *mdd = mdo2mdd(mo);
int rc;
ENTRY;
-
+
if (!S_ISDIR(mdd_object_type(md2mdd_obj(mo))))
RETURN(0);
-
+
rc = mdd_is_parent(ctx, mdd, md2mdd_obj(mo), fid, sfid);
if (rc == -EREMOTE)
rc = EREMOTE;
-
+
RETURN(rc);
}
if (mdd_is_immutable(md2mdd_obj(obj)))
rc = -EACCES;
}
-
+
if (rc == 0)
md2mdd_obj(obj)->mod_count ++;
{
struct ptlrpc_request *req = mdt_info_req(info);
struct mdt_body *body;
- int acl_size = 0;
- int md_size = 0;
+ int acl_size;
+ int md_size;
body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
LASSERT(body != NULL);
struct mdt_reint_record *rr = &info->mti_rr;
struct mdt_rec_setattr *rec;
ENTRY;
-
+
rec = req_capsule_client_get(pill, &RMF_REC_SETATTR);
if (rec == NULL)
RETURN(-EFAULT);
struct req_capsule *pill = &info->mti_pill;
ENTRY;
- if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT))
+ if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT))
info->mti_epoch = req_capsule_client_get(pill, &RMF_MDT_EPOCH);
- else
- /* it is set to NULL already.
+ else
+ /* it is set to NULL already.
info->mti_epoch = NULL;
*/
;
rc = mdt_epoch_unpack(info);
if (rc)
RETURN(rc);
-
+
RETURN(mdt_setattr_unpack_rec(info));
}
attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID |
LA_CTIME | LA_MTIME | LA_ATIME;
info->mti_spec.sp_cr_flags = rec->cr_flags;
-
+
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
if (S_ISDIR(attr->la_mode)) {
struct md_create_spec *sp = &info->mti_spec;
/* pass parent fid for cross-ref cases */
sp->u.sp_pfid = rr->rr_fid1;
if (info->mti_spec.sp_cr_flags & MDS_CREATE_SLAVE_OBJ) {
- /* create salve object req, need
- * unpack split ea here
+ /* create salve object req, need
+ * unpack split ea here
*/
- req_capsule_extend(pill,
+ req_capsule_extend(pill,
&RQF_MDS_REINT_CREATE_SLAVE);
- LASSERT(req_capsule_field_present(pill,
+ LASSERT(req_capsule_field_present(pill,
&RMF_EADATA, RCL_CLIENT));
sp->u.sp_ea.eadata = req_capsule_client_get(pill,
&RMF_EADATA);
} else if (S_ISLNK(attr->la_mode)) {
const char *tgt = NULL;
req_capsule_extend(pill, &RQF_MDS_REINT_CREATE_SYM);
- if (req_capsule_field_present(pill, &RMF_SYMTGT,
+ if (req_capsule_field_present(pill, &RMF_SYMTGT,
RCL_CLIENT)) {
tgt = req_capsule_client_get(pill,
&RMF_SYMTGT);
}
if (tgt == NULL)
result = -EFAULT;
- }
+ }
} else
result = -EFAULT;
RETURN(result);
attr->la_mtime = rec->ul_time;
attr->la_mode = rec->ul_mode;
- attr->la_valid = LA_UID | LA_GID | LA_CTIME |
+ attr->la_valid = LA_UID | LA_GID | LA_CTIME |
LA_MTIME | LA_MODE;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
if (rr->rr_name == NULL)
/* Epoch ends. Is an Size-on-MDS update needed? */
if (o->mot_flags & MF_SOM_CHANGE) {
/* Some previous writer changed the attribute.
- * Do not beleive to the current Size-on-MDS
+ * Do not believe to the current Size-on-MDS
* update, re-ask client. */
rc = -EAGAIN;
} else if (!(la->la_valid & LA_SIZE) && achange) {
&RMF_MDT_BODY
};
-static const struct req_msg_field *mdt_close_msg[] = {
+static const struct req_msg_field *mdt_close_client[] = {
&RMF_PTLRPC_BODY,
&RMF_MDT_EPOCH,
&RMF_REC_SETATTR
const struct req_format RQF_MDS_CLOSE =
DEFINE_REQ_FMT0("MDS_CLOSE",
- mdt_close_msg, mds_last_unlink_server);
+ mdt_close_client, mds_last_unlink_server);
EXPORT_SYMBOL(RQF_MDS_CLOSE);
const struct req_format RQF_MDS_PIN =
const struct req_format RQF_MDS_DONE_WRITING =
DEFINE_REQ_FMT0("MDS_DONE_WRITING",
- mdt_close_msg, mdt_body_only);
+ mdt_close_client, mdt_body_only);
EXPORT_SYMBOL(RQF_MDS_DONE_WRITING);
const struct req_format RQF_MDS_READPAGE =