if (S_ISREG(type)) {
bufcount = 2;
- size[1] = sizeof(struct obdo);
+ size[1] = mdc->mdc_max_mdsize;
} else if (valid & OBD_MD_LINKNAME) {
bufcount = 2;
size[1] = ea_size;
__u64 res_id[RES_NAME_SIZE] = {dir->i_ino};
int size[5] = {sizeof(struct ldlm_request), sizeof(struct ldlm_intent)};
int rc, flags;
+ int repsize[3] = {sizeof(struct ldlm_reply),
+ sizeof(struct mds_body),
+ mdc->mdc_max_mdsize};
struct ldlm_reply *dlm_rep;
struct ldlm_intent *lit;
ENTRY;
mds_create_pack(req, 2, dir, it->it_mode, id, current->fsuid,
current->fsgid, CURRENT_TIME, de->d_name.name,
de->d_name.len, tgt, tgtlen);
-
- size[0] = sizeof(struct ldlm_reply);
- size[1] = sizeof(struct mds_body);
- size[2] = sizeof(struct obdo);
- req->rq_replen = lustre_msg_size(3, size);
+ req->rq_replen = lustre_msg_size(3, repsize);
} else if (it->it_op == IT_RENAME2) {
struct dentry *old_de = it->it_data;
mds_rename_pack(req, 2, old_de->d_parent->d_inode, dir,
old_de->d_name.name, old_de->d_name.len,
de->d_name.name, de->d_name.len);
-
- size[0] = sizeof(struct ldlm_reply);
- req->rq_replen = lustre_msg_size(1, size);
- } else if (it->it_op == IT_UNLINK) {
+ req->rq_replen = lustre_msg_size(1, repsize);
+ } else if (it->it_op == IT_UNLINK || it->it_op == IT_RMDIR) {
size[2] = sizeof(struct mds_rec_unlink);
size[3] = de->d_name.len + 1;
req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
/* pack the intended request */
mds_unlink_pack(req, 2, dir, NULL, de->d_name.name,
de->d_name.len);
- size[0] = sizeof(struct ldlm_reply);
- size[1] = sizeof(struct obdo);
- req->rq_replen = lustre_msg_size(2, size);
- } else if (it->it_op == IT_RMDIR) {
- size[2] = sizeof(struct mds_rec_unlink);
- size[3] = de->d_name.len + 1;
- req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
- &mdc->mdc_connh, LDLM_ENQUEUE, 4, size,
- NULL);
- if (!req)
- RETURN(-ENOMEM);
- /* pack the intent */
- lit = lustre_msg_buf(req->rq_reqmsg, 1);
- lit->opc = NTOH__u64((__u64)it->it_op);
-
- /* pack the intended request */
- mds_unlink_pack(req, 2, dir, NULL, de->d_name.name,
- de->d_name.len);
- size[0] = sizeof(struct ldlm_reply);
- req->rq_replen = lustre_msg_size(1, size);
+ req->rq_replen = lustre_msg_size(3, repsize);
} else if (it->it_op == IT_GETATTR || it->it_op == IT_RENAME ||
it->it_op == IT_OPEN || it->it_op == IT_SETATTR ||
it->it_op == IT_LOOKUP) {
mds_getattr_pack(req, 2, dir, de->d_name.name, de->d_name.len);
/* get ready for the reply */
- size[0] = sizeof(struct ldlm_reply);
- size[1] = sizeof(struct mds_body);
- size[2] = sizeof(struct obdo);
- req->rq_replen = lustre_msg_size(3, size);
+ req->rq_replen = lustre_msg_size(3, repsize);
} else if (it->it_op == IT_READDIR) {
req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
&mdc->mdc_connh, LDLM_ENQUEUE, 1, size, NULL);
RETURN(-ENOMEM);
/* get ready for the reply */
- size[0] = sizeof(struct ldlm_reply);
- req->rq_replen = lustre_msg_size(1, size);
+ req->rq_replen = lustre_msg_size(1, repsize);
} else {
LBUG();
RETURN(-1);
}
int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
- struct obdo *obdo,
+ struct lov_stripe_md *md,
__u64 cookie, __u64 *fh, struct ptlrpc_request **request)
{
struct mdc_obd *mdc = mdc_conn2mdc(conn);
struct ptlrpc_request *req;
ENTRY;
- if (obdo != NULL) {
+ if (md != NULL) {
bufcount = 2;
- size[1] = sizeof(*obdo);
+ size[1] = md->lmd_size;
}
req = ptlrpc_prep_req2(mdc->mdc_client, mdc->mdc_conn, &mdc->mdc_connh,
body->flags = HTON__u32(flags);
body->extra = cookie;
- if (obdo != NULL)
- memcpy(lustre_msg_buf(req->rq_reqmsg, 1), obdo, sizeof(*obdo));
+ if (md != NULL)
+ memcpy(lustre_msg_buf(req->rq_reqmsg, 1), md, md->lmd_size);
req->rq_replen = lustre_msg_size(1, size);
rc = ptlrpc_queue_wait(req);
rc = ptlrpc_check_status(req, rc);
-
if (!rc) {
body = lustre_msg_buf(req->rq_repmsg, 0);
mds_unpack_body(body);
mdc->mdc_ldlm_client);
mdc->mdc_client->cli_name = "mdc";
mdc->mdc_ldlm_client->cli_name = "ldlm";
+ mdc->mdc_max_mdsize = sizeof(struct lov_stripe_md);
/* XXX get recovery hooked in here again */
//ptlrpc_init_client(ptlrpc_connmgr, ll_recover,...