From 2ac16ab5ab7b879e5dd9dec61e078280932086d5 Mon Sep 17 00:00:00 2001 From: braam Date: Thu, 22 Aug 2002 18:29:55 +0000 Subject: [PATCH] fixes for LOV -- CAREFUL this may break the tree... --- lustre/include/linux/lustre_lite.h | 2 +- lustre/include/linux/obd_lov.h | 1 + lustre/lib/lov_pack.c | 15 +++++++++++++++ lustre/llite/super.c | 13 ++++++++----- lustre/mdc/mdc_reint.c | 7 +++---- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 8c1f66c..d48f32e 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -32,7 +32,7 @@ struct ll_file_data { 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) diff --git a/lustre/include/linux/obd_lov.h b/lustre/include/linux/obd_lov.h index 11f3a48..5aace10 100644 --- a/lustre/include/linux/obd_lov.h +++ b/lustre/include/linux/obd_lov.h @@ -12,6 +12,7 @@ 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 diff --git a/lustre/lib/lov_pack.c b/lustre/lib/lov_pack.c index b957eeb..74b8ab8 100644 --- a/lustre/lib/lov_pack.c +++ b/lustre/lib/lov_pack.c @@ -57,3 +57,18 @@ void lov_packmd(struct lov_mds_md *mdsmd, struct lov_stripe_md *md) for (i=0; ilmd_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; ilmd_stripe_count; i++) + md->lmd_oinfo[i].loi_id = mdsmd->lmd_objects[i].l_object_id; +} diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 42ca48c..fc57730 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -396,7 +397,7 @@ out: 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; @@ -482,19 +483,21 @@ static void ll_read_inode2(struct inode *inode, void *opaque) //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); */ diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index c811bd6..bf724e2 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -80,7 +80,7 @@ int mdc_create(struct lustre_handle *conn, 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; @@ -91,18 +91,17 @@ int mdc_create(struct lustre_handle *conn, 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); -- 1.8.3.1