struct ll_inode_md {
struct mds_body *body;
- struct lov_stripe_md *md;
+ struct lov_mds_md *md;
};
#define LL_IOC_GETFLAGS _IOR ('f', 151, long)
void lov_unpackdesc(struct lov_desc *ld);
void lov_packdesc(struct lov_desc *ld);
void lov_packmd(struct lov_mds_md *mdsmd, struct lov_stripe_md *md);
+void lov_unpackmd(struct lov_stripe_md *md, struct lov_mds_md *mdsmd);
#endif
#endif
for (i=0; i<md->lmd_stripe_count; i++)
mdsmd->lmd_objects[i].l_object_id = md->lmd_oinfo[i].loi_id;
}
+
+void lov_unpackmd(struct lov_stripe_md *md, struct lov_mds_md *mdsmd)
+{
+ int i;
+ md->lmd_magic = mdsmd->lmd_magic;
+ md->lmd_easize = mdsmd->lmd_easize;
+ md->lmd_object_id = mdsmd->lmd_object_id;
+ md->lmd_stripe_offset = mdsmd->lmd_stripe_offset;
+ md->lmd_stripe_count = mdsmd->lmd_stripe_count;
+ md->lmd_stripe_size = mdsmd->lmd_stripe_size;
+ md->lmd_stripe_pattern = mdsmd->lmd_stripe_pattern;
+
+ for (i=0; i<md->lmd_stripe_count; i++)
+ md->lmd_oinfo[i].loi_id = mdsmd->lmd_objects[i].l_object_id;
+}
#include <linux/random.h>
#include <linux/lustre_lite.h>
#include <linux/lustre_ha.h>
+#include <linux/obd_lov.h>
#include <linux/lustre_dlm.h>
#include <linux/init.h>
RETURN(rc);
}
-inline int ll_stripe_md_size(struct super_block *sb)
+inline int ll_stripe_mds_md_size(struct super_block *sb)
{
struct client_obd *mdc = sbi2mdc(ll_s2sbi(sb));
return mdc->cl_max_mdsize;
//if (body->valid & OBD_MD_FLEASIZE)
if (md && md->md && md->md->lmd_stripe_count) {
- struct lov_stripe_md *smd = md->md;
- int size = ll_stripe_md_size(inode->i_sb);
- if (md->md->lmd_easize != size) {
+ struct lov_mds_md *smd = md->md;
+ int size;
+ if (md->md->lmd_easize != ll_stripe_mds_md_size(inode->i_sb)) {
CERROR("Striping metadata size error %ld\n",
inode->i_ino);
LBUG();
}
+ size = sizeof(*ii->lli_smd) +
+ md->md->lmd_stripe_count * sizeof(struct lov_oinfo);
OBD_ALLOC(ii->lli_smd, size);
if (!ii->lli_smd){
CERROR("No memory for %d\n", size);
LBUG();
}
- memcpy(ii->lli_smd, smd, size);
+ lov_unpackmd(ii->lli_smd, smd);
}
/* OIDEBUG(inode); */
struct mds_rec_create *rec;
struct ptlrpc_request *req;
int rc, size[3] = {sizeof(struct mds_rec_create), namelen + 1, 0};
- char *tmp, *bufs[3] = {NULL, NULL, NULL};
+ char *tmp;
int level, bufcount = 2;
ENTRY;
LBUG();
}
size[2] = smd->lmd_easize;
- bufs[2] = (char *)smd;
bufcount = 3;
} else if (S_ISLNK(mode)) {
size[2] = tgtlen + 1;
bufcount = 3;
}
- req = ptlrpc_prep_req2(conn, MDS_REINT, bufcount, size, bufs);
+ req = ptlrpc_prep_req2(conn, MDS_REINT, bufcount, size, NULL);
if (!req)
RETURN(-ENOMEM);
- /* mds_create_pack fills bufs[1] with name */
+ /* mds_create_pack fills msg->bufs[1] with name */
rec = lustre_msg_buf(req->rq_reqmsg, 0);
mds_create_pack(req, 0, dir, mode, rdev, uid, gid, time,
name, namelen, NULL, 0);