Whamcloud - gitweb
- fixes in reading store by seq-mgr;
authoryury <yury>
Thu, 7 Sep 2006 15:44:15 +0000 (15:44 +0000)
committeryury <yury>
Thu, 7 Sep 2006 15:44:15 +0000 (15:44 +0000)
- cleanups about le_cpu, etc., functions.

lustre/fid/fid_lib.c
lustre/fid/fid_store.c
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_fid.h
lustre/llite/dir.c
lustre/lmv/lmv_obd.c
lustre/osd/osd_handler.c
lustre/osd/osd_oi.c

index a9476bf..a979299 100644 (file)
@@ -42,7 +42,7 @@
 #include <lu_object.h>
 #include <lustre_fid.h>
 
-void fid_to_le(struct lu_fid *dst, const struct lu_fid *src)
+void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src)
 {
         /* check that all fields are converted */
         CLASSERT(sizeof *src ==
@@ -52,21 +52,21 @@ void fid_to_le(struct lu_fid *dst, const struct lu_fid *src)
         dst->f_oid = cpu_to_le32(fid_oid(src));
         dst->f_ver = cpu_to_le32(fid_ver(src));
 }
-EXPORT_SYMBOL(fid_to_le);
+EXPORT_SYMBOL(fid_cpu_to_le);
 
-void fid_to_be(struct lu_fid *dst, const struct lu_fid *src)
+void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 {
         /* check that all fields are converted */
         CLASSERT(sizeof *src ==
                  sizeof fid_seq(src) +
                  sizeof fid_oid(src) + sizeof fid_ver(src));
-        dst->f_seq = cpu_to_be64(fid_seq(src));
-        dst->f_oid = cpu_to_be32(fid_oid(src));
-        dst->f_ver = cpu_to_be32(fid_ver(src));
+        dst->f_seq = le64_to_cpu(fid_seq(src));
+        dst->f_oid = le32_to_cpu(fid_oid(src));
+        dst->f_ver = le32_to_cpu(fid_ver(src));
 }
-EXPORT_SYMBOL(fid_to_be);
+EXPORT_SYMBOL(fid_le_to_cpu);
 
-void range_to_le(struct lu_range *dst, const struct lu_range *src)
+void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
         CLASSERT(sizeof *src ==
@@ -75,16 +75,15 @@ void range_to_le(struct lu_range *dst, const struct lu_range *src)
         dst->lr_start = cpu_to_le64(src->lr_start);
         dst->lr_end = cpu_to_le64(src->lr_end);
 }
-EXPORT_SYMBOL(range_to_le);
+EXPORT_SYMBOL(range_cpu_to_le);
 
-void range_to_be(struct lu_range *dst, const struct lu_range *src)
+void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
         CLASSERT(sizeof *src ==
                  sizeof src->lr_start +
                  sizeof src->lr_end);
-        dst->lr_start = cpu_to_be64(src->lr_start);
-        dst->lr_end = cpu_to_be64(src->lr_end);
+        dst->lr_start = le64_to_cpu(src->lr_start);
+        dst->lr_end = le64_to_cpu(src->lr_end);
 }
-EXPORT_SYMBOL(range_to_be);
-
+EXPORT_SYMBOL(range_le_to_cpu);
index 57bd621..3edf95b 100644 (file)
@@ -74,8 +74,8 @@ int seq_store_write(struct lu_server_seq *seq,
         th = dt_dev->dd_ops->dt_trans_start(ctx, dt_dev, &info->sti_txn);
         if (!IS_ERR(th)) {
                 /* store ranges in le format */
-                range_to_le(&info->sti_record.ssr_space, &seq->lss_space);
-                range_to_le(&info->sti_record.ssr_super, &seq->lss_super);
+                range_cpu_to_le(&info->sti_record.ssr_space, &seq->lss_space);
+                range_cpu_to_le(&info->sti_record.ssr_super, &seq->lss_super);
  
                 rc = dt_obj->do_body_ops->dbo_write(ctx, dt_obj,
                                                     (char *)&info->sti_record,
@@ -119,12 +119,8 @@ int seq_store_read(struct lu_server_seq *seq,
                                            sizeof(info->sti_record), &pos);
         
         if (rc == sizeof(info->sti_record)) {
-                seq->lss_space = info->sti_record.ssr_space;
-                seq->lss_super = info->sti_record.ssr_super;
-
-                lustre_swab_lu_range(&seq->lss_space);
-                lustre_swab_lu_range(&seq->lss_super);
-
+                range_le_to_cpu(&seq->lss_space, &info->sti_record.ssr_space);
+                range_le_to_cpu(&seq->lss_super, &info->sti_record.ssr_super);
                 CDEBUG(D_INFO, "read %s ranges: space - "DRANGE", super - "
                        DRANGE"\n", (seq->lss_type == LUSTRE_SEQ_SERVER ?
                                     "server" : "controller"),
index c4f7eff..30be4cb 100644 (file)
@@ -261,20 +261,6 @@ static inline int lu_fid_eq(const struct lu_fid *f0,
        return memcmp(f0, f1, sizeof *f0) == 0;
 }
 
-static inline void fid_cpu_to_le(struct lu_fid *fid)
-{
-        fid->f_seq = cpu_to_le64(fid_seq(fid));
-        fid->f_oid = cpu_to_le32(fid_oid(fid));
-        fid->f_ver = cpu_to_le32(fid_ver(fid));
-}
-
-static inline void fid_le_to_cpu(struct lu_fid *fid)
-{
-        fid->f_seq = le64_to_cpu(fid_seq(fid));
-        fid->f_oid = le32_to_cpu(fid_oid(fid));
-        fid->f_ver = le32_to_cpu(fid_ver(fid));
-}
-
 /*
  * Layout of readdir pages, as transmitted on wire.
  */
index 0f06f41..730b44a 100644 (file)
@@ -182,11 +182,12 @@ int seq_client_alloc_fid(struct lu_client_seq *seq,
 
 /* Fids common stuff */
 int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
-void fid_to_le(struct lu_fid *dst, const struct lu_fid *src);
-void fid_to_be(struct lu_fid *dst, const struct lu_fid *src);
+
+void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src);
+void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src);
 
 /* Range common stuff */
-void range_to_le(struct lu_range *dst, const struct lu_range *src);
-void range_to_be(struct lu_range *dst, const struct lu_range *src);
+void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src);
+void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src);
 
 #endif /* __LINUX_OBD_CLASS_H */
index 9b361d2..1eb10e2 100644 (file)
@@ -47,6 +47,7 @@
 #include <lustre/lustre_idl.h>
 #include <lustre_lite.h>
 #include <lustre_dlm.h>
+#include <lustre_fid.h>
 #include "llite_internal.h"
 
 #define PageChecked(page)        test_bit(PG_checked, &(page)->flags)
@@ -479,7 +480,7 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
 
                                 fid  = ent->lde_fid;
                                 name = ent->lde_name;
-                                fid_le_to_cpu(&fid);
+                                fid_le_to_cpu(&fid, &fid);
                                 ino  = ll_fid_build_ino(sbi, &fid);
 
                                 done = filldir(cookie, name, namelen,
index 072bfad..1a85d34 100644 (file)
@@ -45,6 +45,7 @@
 #include <obd_class.h>
 #include <lprocfs_status.h>
 #include <lustre_lite.h>
+#include <lustre_fid.h>
 #include "lmv_internal.h"
 
 /* not defined for liblustre building */
@@ -2181,7 +2182,7 @@ int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
 
         for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
                 meap->mea_ids[i] = meap->mea_ids[i];
-                fid_cpu_to_le(&meap->mea_ids[i]);
+                fid_cpu_to_le(&meap->mea_ids[i], &meap->mea_ids[i]);
         }
 
         RETURN(mea_size);
@@ -2231,7 +2232,7 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
 
         for (i = 0; i < (*tmea)->mea_count; i++) {
                 (*tmea)->mea_ids[i] = mea->mea_ids[i];
-                fid_le_to_cpu(&(*tmea)->mea_ids[i]);
+                fid_le_to_cpu(&(*tmea)->mea_ids[i], &(*tmea)->mea_ids[i]);
         }
         RETURN(mea_size);
 }
index 06f983c..542eab5 100644 (file)
@@ -1105,7 +1105,7 @@ static int osd_dir_page_build(const struct lu_context *ctx, int first,
                 len  = iops->key_size(ctx, it);
 
                 *fid  = *(struct lu_fid *)iops->rec(ctx, it);
-                fid_cpu_to_le(fid);
+                fid_cpu_to_le(fid, fid);
 
                 recsize = (sizeof *ent + len + 3) & ~3;
                 hash = iops->store(ctx, it);
index 92b2d9d..be93d25 100644 (file)
@@ -134,7 +134,7 @@ void osd_oi_write_unlock(struct osd_oi *oi)
 static const struct dt_key *oi_fid_key(struct osd_thread_info *info,
                                        const struct lu_fid *fid)
 {
-        fid_to_be(&info->oti_fid, fid);
+        fid_cpu_to_be(&info->oti_fid, fid);
         return (const struct dt_key *)&info->oti_fid;
 }