Whamcloud - gitweb
fixes for LOV -- CAREFUL this may break the tree...
authorbraam <braam>
Thu, 22 Aug 2002 18:29:55 +0000 (18:29 +0000)
committerbraam <braam>
Thu, 22 Aug 2002 18:29:55 +0000 (18:29 +0000)
lustre/include/linux/lustre_lite.h
lustre/include/linux/obd_lov.h
lustre/lib/lov_pack.c
lustre/llite/super.c
lustre/mdc/mdc_reint.c

index 8c1f66c..d48f32e 100644 (file)
@@ -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)
index 11f3a48..5aace10 100644 (file)
@@ -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
index b957eeb..74b8ab8 100644 (file)
@@ -57,3 +57,18 @@ void lov_packmd(struct lov_mds_md *mdsmd, struct lov_stripe_md *md)
         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; 
+}
index 42ca48c..fc57730 100644 (file)
@@ -15,6 +15,7 @@
 #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>
 
@@ -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); */
index c811bd6..bf724e2 100644 (file)
@@ -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);