From: yury Date: Thu, 7 Sep 2006 15:44:15 +0000 (+0000) Subject: - fixes in reading store by seq-mgr; X-Git-Tag: v1_8_0_110~486^2~987 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a612a38a073a00e85a6e5083efbbef95c45ab231;p=fs%2Flustre-release.git - fixes in reading store by seq-mgr; - cleanups about le_cpu, etc., functions. --- diff --git a/lustre/fid/fid_lib.c b/lustre/fid/fid_lib.c index a9476bf8..a979299 100644 --- a/lustre/fid/fid_lib.c +++ b/lustre/fid/fid_lib.c @@ -42,7 +42,7 @@ #include #include -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); diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index 57bd621..3edf95b 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -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"), diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index c4f7eff..30be4cb 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -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. */ diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 0f06f41..730b44a 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -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 */ diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 9b361d2..1eb10e2 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -47,6 +47,7 @@ #include #include #include +#include #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, diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 072bfad..1a85d34 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -45,6 +45,7 @@ #include #include #include +#include #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); } diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 06f983c..542eab5 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -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); diff --git a/lustre/osd/osd_oi.c b/lustre/osd/osd_oi.c index 92b2d9d..be93d25 100644 --- a/lustre/osd/osd_oi.c +++ b/lustre/osd/osd_oi.c @@ -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; }