Whamcloud - gitweb
- OBD_ALLOC() of obdos are replaced by obdo_alloc(), the same about obdo_free().
authoryury <yury>
Thu, 18 Nov 2004 11:40:12 +0000 (11:40 +0000)
committeryury <yury>
Thu, 18 Nov 2004 11:40:12 +0000 (11:40 +0000)
- added ldiskfs module info generation to portals/utils/debug.c
- added packing/unpacking for mea in lmv_obd.c
- small cleanups.

lnet/utils/debug.c
lustre/include/linux/lustre_net.h
lustre/llite/rw24.c
lustre/lmv/lmv_obd.c
lustre/mds/mds_fs.c
lustre/mds/mds_lov.c
lustre/obdfilter/filter.c
lustre/portals/utils/debug.c

index ba73aeb..d5ff09a 100644 (file)
@@ -620,6 +620,7 @@ static struct mod_paths {
         {"mds", "lustre/mds"},
         {"mdc", "lustre/mdc"},
         {"llite", "lustre/llite"},
+        {"ldiskfs", "lustre/ldiskfs"},
         {"smfs", "lustre/smfs"},
         {"obdecho", "lustre/obdecho"},
         {"ldlm", "lustre/ldlm"},
index 01fa614..d0694f9 100644 (file)
@@ -751,6 +751,9 @@ void mdc_pack_id(struct lustre_id *id, obd_id ino,
 #define id_group(id)                            \
         (id)->li_fid.lf_group
 
+#define id_version(id)                          \
+        (id)->li_fid.lf_version
+
 #define id_assign_fid(id1, id2)                 \
         ((id1)->li_fid = (id2)->li_fid)
 
@@ -771,6 +774,26 @@ void mdc_pack_id(struct lustre_id *id, obd_id ino,
         (id_ino((id1)) == id_ino((id2)) &&      \
          id_gen((id1)) == id_gen((id2)))
 
+#define id_le_to_cpu(id)                                                \
+        do {                                                            \
+                id_fid((id)) = le64_to_cpu(id_fid((id)));               \
+                id_group((id)) = le64_to_cpu(id_group((id)));           \
+                id_version((id)) = le32_to_cpu(id_version((id)));       \
+                id_ino((id)) = le64_to_cpu(id_ino((id)));               \
+                id_gen((id)) = le32_to_cpu(id_gen((id)));               \
+                id_type((id)) = le32_to_cpu(id_type((id)));             \
+        } while (0)
+
+#define id_cpu_to_le(id)                                                \
+        do {                                                            \
+                id_fid((id)) = cpu_to_le64(id_fid((id)));               \
+                id_group((id)) = cpu_to_le64(id_group((id)));           \
+                id_version((id)) = cpu_to_le32(id_version((id)));       \
+                id_ino((id)) = cpu_to_le64(id_ino((id)));               \
+                id_gen((id)) = cpu_to_le32(id_gen((id)));               \
+                id_type((id)) = cpu_to_le32(id_type((id)));             \
+        } while (0)
+
 #ifdef __KERNEL__
 static inline void
 mdc_inode2id(struct lustre_id *id, struct inode *inode)
index 9c95c94..cd1b1ce 100644 (file)
@@ -100,7 +100,6 @@ static int ll_direct_IO_24(int rw, struct inode *inode, struct kiobuf *iobuf,
                         POISON_PAGE(iobuf->maplist[i], 0x0d);
         }
 
-
         oa = obdo_alloc();
         if (oa == NULL) {
                 ptlrpc_set_destroy(set);
index 3f898f2..e88dfc4 100644 (file)
@@ -1826,11 +1826,12 @@ int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct lmv_obd *lmv = &obd->u.lmv;
-        int mea_size;
+        struct mea *meap, *lsmp;
+        int mea_size, i;
         ENTRY;
 
-       mea_size = sizeof(struct lustre_id) * 
-                lmv->desc.ld_tgt_count + sizeof(struct mea);
+       mea_size = (sizeof(struct lustre_id) * 
+                    lmv->desc.ld_tgt_count) + sizeof(struct mea);
         if (!lmmp)
                 RETURN(mea_size);
 
@@ -1849,8 +1850,18 @@ int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
         if (!lsm)
                 RETURN(mea_size);
 
-#warning "MEA packing/convertation must be here! -bzzz"
-        memcpy(*lmmp, lsm, mea_size);
+        lsmp = (struct mea *)lsm;
+        meap = (struct mea *)*lmmp;
+
+        meap->mea_magic = cpu_to_le32(lsmp->mea_magic);
+        meap->mea_count = cpu_to_le32(lsmp->mea_count);
+        meap->mea_master = cpu_to_le32(lsmp->mea_master);
+
+        for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
+                meap->mea_ids[i] = meap->mea_ids[i];
+                id_cpu_to_le(&meap->mea_ids[i]);
+        }
+
         RETURN(mea_size);
 }
 
@@ -1858,10 +1869,10 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **mem_tgt,
                  struct lov_mds_md *disk_src, int mdsize)
 {
         struct obd_device *obd = class_exp2obd(exp);
+        struct mea **tmea = (struct mea **)mem_tgt;
+        struct mea *mea = (struct mea *)disk_src;
         struct lmv_obd *lmv = &obd->u.lmv;
-        struct mea **tmea = (struct mea **) mem_tgt;
-        struct mea *mea = (void *) disk_src;
-        int mea_size;
+        int mea_size, i;
         ENTRY;
 
        mea_size = sizeof(struct lustre_id) * 
@@ -1883,8 +1894,15 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **mem_tgt,
         if (!disk_src)
                 RETURN(mea_size);
 
-#warning "MEA unpacking/convertation must be here! -bzzz"
-        memcpy(*tmea, mea, mdsize);
+        (*tmea)->mea_magic = le32_to_cpu(mea->mea_magic);
+        (*tmea)->mea_count = le32_to_cpu(mea->mea_count);
+        (*tmea)->mea_master = le32_to_cpu(mea->mea_master);
+
+        for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
+                (*tmea)->mea_ids[i] = mea->mea_ids[i];
+                id_le_to_cpu(&(*tmea)->mea_ids[i]);
+        }
+
         RETURN(mea_size);
 }
 
index ba2561f..c84d86f 100644 (file)
@@ -101,9 +101,9 @@ int mds_client_add(struct obd_device *obd, struct mds_obd *mds,
                 (cl_idx * le16_to_cpu(mds->mds_server_data->msd_client_size));
 
         if (new_client) {
+                struct file *file = mds->mds_rcvd_filp;
                 struct lvfs_run_ctxt saved;
                 loff_t off = med->med_off;
-                struct file *file = mds->mds_rcvd_filp;
                 int rc;
 
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
@@ -124,11 +124,11 @@ int mds_client_free(struct obd_export *exp, int clear_client)
 {
         struct mds_export_data *med = &exp->exp_mds_data;
         struct mds_obd *mds = &exp->exp_obd->u.mds;
+        unsigned long *bitmap = mds->mds_client_bitmap;
         struct obd_device *obd = exp->exp_obd;
         struct mds_client_data zero_mcd;
         struct lvfs_run_ctxt saved;
         int rc;
-        unsigned long *bitmap = mds->mds_client_bitmap;
 
         if (!med->med_mcd)
                 RETURN(0);
@@ -174,7 +174,7 @@ int mds_client_free(struct obd_export *exp, int clear_client)
          * transactions have been committed. */
         mds_update_server_data(exp->exp_obd, 1);
 
- free_and_out:
+free_and_out:
         OBD_FREE(med->med_mcd, sizeof(*med->med_mcd));
         return 0;
 }
@@ -233,11 +233,11 @@ static int mds_read_last_fid(struct obd_device *obd, struct file *file)
 
 static int mds_read_last_rcvd(struct obd_device *obd, struct file *file)
 {
+        unsigned long last_rcvd_size = file->f_dentry->d_inode->i_size;
         struct mds_obd *mds = &obd->u.mds;
-        struct mds_server_data *msd;
+        struct mds_server_data *msd = NULL;
         struct mds_client_data *mcd = NULL;
         loff_t off = 0;
-        unsigned long last_rcvd_size = file->f_dentry->d_inode->i_size;
         __u64 mount_count;
         int cl_idx, rc = 0;
         ENTRY;
@@ -461,35 +461,32 @@ int mds_fs_setup_rootid(struct obd_device *obd)
         void *handle;
         struct inode *inode;
         struct dentry *dentry;
-        struct lustre_id rootid;
         struct mds_obd *mds = &obd->u.mds;
         ENTRY;
 
-        memcpy(&rootid, &mds->mds_rootid, sizeof(rootid));
-        
         /* getting root directory and setup its fid. */
-        dentry = mds_id2dentry(obd, &rootid, NULL);
+        dentry = mds_id2dentry(obd, &mds->mds_rootid, NULL);
         if (IS_ERR(dentry)) {
-                CERROR("Can't find ROOT, err = %d\n",
-                       (int)PTR_ERR(dentry));
+                CERROR("Can't find ROOT by "DLID4", err = %d\n",
+                       OLID4(&mds->mds_rootid), (int)PTR_ERR(dentry));
                 RETURN(PTR_ERR(dentry));
         }
 
         inode = dentry->d_inode;
         LASSERT(dentry->d_inode);
 
-        rc = mds_pack_inode2id(obd, &rootid, inode, 1);
+        rc = mds_pack_inode2id(obd, &mds->mds_rootid, inode, 1);
         if (rc < 0) {
                 if (rc != -ENODATA)
-                        goto out_dentry;
+                        GOTO(out_dentry, rc);
         } else {
                 /*
                  * rootid is filled by mds_read_inode_sid(), so we do not need
                  * to allocate it and update. The only thing we need to check is
                  * mds_num.
                  */
-                LASSERT(id_group(&rootid) == mds->mds_num);
-                mds_set_last_fid(obd, id_fid(&rootid));
+                LASSERT(id_group(&mds->mds_rootid) == mds->mds_num);
+                mds_set_last_fid(obd, id_fid(&mds->mds_rootid));
                 GOTO(out_dentry, rc);
         }
 
@@ -504,7 +501,7 @@ int mds_fs_setup_rootid(struct obd_device *obd)
         }
         
         down(&inode->i_sem);
-        rc = mds_alloc_inode_sid(obd, inode, handle, &rootid);
+        rc = mds_alloc_inode_sid(obd, inode, handle, &mds->mds_rootid);
         up(&inode->i_sem);
         
         if (rc) {
@@ -517,14 +514,13 @@ int mds_fs_setup_rootid(struct obd_device *obd)
         if (rc)
                 CERROR("fsfilt_commit() failed, rc = %d\n", rc);
 
+        EXIT;
 out_dentry:
         l_dput(dentry);
-        if (rc == 0) {
-                memcpy(&mds->mds_rootid, &rootid, sizeof(rootid));
+        if (rc == 0)
                 CWARN("%s: rootid: "DLID4"\n", obd->obd_name,
-                      OLID4(&rootid));
-        }
-        RETURN(rc);
+                      OLID4(&mds->mds_rootid));
+        return rc;
 }
 
 /*
index 75261a5..6a412e5 100644 (file)
@@ -133,7 +133,7 @@ int mds_lov_clearorphans(struct mds_obd *mds, struct obd_uuid *ost_uuid)
          * missing objects below this ID, they will be created.  If it finds
          * objects above this ID, they will be removed.
          */
-        OBD_ALLOC(oa, sizeof(*oa));
+       oa = obdo_alloc();
         if (oa == NULL)
                 RETURN(-ENOMEM);
         
@@ -147,7 +147,7 @@ int mds_lov_clearorphans(struct mds_obd *mds, struct obd_uuid *ost_uuid)
                 oa->o_valid |= OBD_MD_FLINLINE;
         }
         rc = obd_create(mds->mds_lov_exp, oa, &empty_ea, &oti);
-        OBD_FREE(oa, sizeof(*oa));
+        obdo_free(oa);
         RETURN(rc);
 }
 
@@ -848,10 +848,10 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
                           struct lustre_msg *msg, int offset)
 {
         struct mds_obd *mds = &obd->u.mds;
-        struct obd_export *osc_exp = mds->mds_lov_exp;
+        struct obd_export *lov_exp = mds->mds_lov_exp;
         struct lov_mds_md *lmm= NULL;
         struct lov_stripe_md *lsm = NULL;
-        struct obdo *oa;
+        struct obdo *oa = NULL;
         struct obd_trans_info oti = {0};
         obd_valid valid = 0;
         int lmm_size = 0, lsm_size = 0, err, rc;
@@ -872,7 +872,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
         }
         lmm_size = msg->buflens[offset];
 
-        rc = obd_unpackmd(osc_exp, &lsm, lmm, lmm_size);
+        rc = obd_unpackmd(lov_exp, &lsm, lmm, lmm_size);
         if (rc < 0)
                 RETURN(0);
 
@@ -897,7 +897,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
                 OBD_MD_FLCTIME;
         obdo_from_inode(oa, inode, valid);
 
-        rc = obd_revalidate_md(osc_exp, oa, lsm, &oti);
+        rc = obd_revalidate_md(lov_exp, oa, lsm, &oti);
         if (rc == 0)
                 GOTO(out_oa, rc);
         if (rc < 0) {
@@ -906,7 +906,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
                 GOTO(out_oa, rc);
         }
 
-        rc = obd_packmd(osc_exp, &lmm, lsm);
+        rc = obd_packmd(lov_exp, &lmm, lsm);
         if (rc < 0)
                 GOTO(out_oa, rc);
         lmm_size = rc;
@@ -926,6 +926,6 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
 out_oa:
         obdo_free(oa);
 out_lsm:
-        obd_free_memmd(osc_exp, &lsm);
+        obd_free_memmd(lov_exp, &lsm);
         return rc;
 }
index 49e73aa..4a36717 100644 (file)
@@ -2170,6 +2170,7 @@ static void filter_destroy_precreated(struct obd_export *exp, struct obdo *oa,
         LASSERT(oa->o_valid & OBD_MD_FLGROUP);
 
         OBD_ALLOC(doa, sizeof(*doa));
+       doa = obdo_alloc();
         if (doa == NULL) {
                 CERROR("cannot allocate doa, error %d\n",
                        -ENOMEM);
@@ -2177,7 +2178,6 @@ static void filter_destroy_precreated(struct obd_export *exp, struct obdo *oa,
                 return;
         }
 
-        memset(doa, 0, sizeof(*doa));
         doa->o_mode = S_IFREG;
         doa->o_gr = oa->o_gr;
         doa->o_valid = oa->o_valid & (OBD_MD_FLGROUP | OBD_MD_FLID);
@@ -2209,7 +2209,7 @@ static void filter_destroy_precreated(struct obd_export *exp, struct obdo *oa,
 
         EXIT;
 out_free_doa:
-        OBD_FREE(doa, sizeof(*doa));
+        obdo_free(doa);
 }
 
 /* returns a negative error or a nonnegative number of files to create */
index ba73aeb..d5ff09a 100644 (file)
@@ -620,6 +620,7 @@ static struct mod_paths {
         {"mds", "lustre/mds"},
         {"mdc", "lustre/mdc"},
         {"llite", "lustre/llite"},
+        {"ldiskfs", "lustre/ldiskfs"},
         {"smfs", "lustre/smfs"},
         {"obdecho", "lustre/obdecho"},
         {"ldlm", "lustre/ldlm"},