Whamcloud - gitweb
LU-3963 libcfs: remove cfs_hash_long
[fs/lustre-release.git] / lustre / include / lustre_fid.h
index a1caa5c..cf8ba16 100644 (file)
@@ -311,10 +311,10 @@ static inline int fid_seq_in_fldb(__u64 seq)
               fid_seq_is_root(seq) || fid_seq_is_dot(seq);
 }
 
-static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq)
+static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq, __u32 ost_idx)
 {
        if (fid_seq_is_mdt0(seq)) {
-               fid->f_seq = fid_idif_seq(0, 0);
+               fid->f_seq = fid_idif_seq(0, ost_idx);
        } else {
                LASSERTF(fid_seq_is_norm(seq) || fid_seq_is_echo(seq) ||
                         fid_seq_is_idif(seq), LPX64"\n", seq);
@@ -438,12 +438,12 @@ struct lu_server_seq {
 
 /* Server methods */
 
-int seq_server_init(struct lu_server_seq *seq,
+int seq_server_init(const struct lu_env *env,
+                   struct lu_server_seq *seq,
                    struct dt_device *dev,
                    const char *prefix,
                    enum lu_mgr_type type,
-                   struct seq_server_site *ss,
-                   const struct lu_env *env);
+                   struct seq_server_site *ss);
 
 void seq_server_fini(struct lu_server_seq *seq,
                      const struct lu_env *env);
@@ -456,9 +456,9 @@ int seq_server_alloc_meta(struct lu_server_seq *seq,
                           struct lu_seq_range *out,
                           const struct lu_env *env);
 
-int seq_server_set_cli(struct lu_server_seq *seq,
-                       struct lu_client_seq *cli,
-                       const struct lu_env *env);
+int seq_server_set_cli(const struct lu_env *env,
+                      struct lu_server_seq *seq,
+                      struct lu_client_seq *cli);
 
 /* Client methods */
 int seq_client_init(struct lu_client_seq *seq,
@@ -598,19 +598,6 @@ static inline void ostid_build_res_name(struct ost_id *oi,
        }
 }
 
-static inline void ostid_res_name_to_id(struct ost_id *oi,
-                                       struct ldlm_res_id *name)
-{
-       if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_SEQ_OFF])) {
-               /* old resid */
-               ostid_set_seq(oi, name->name[LUSTRE_RES_ID_VER_OID_OFF]);
-               ostid_set_id(oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
-       } else {
-               /* new resid */
-               fid_extract_from_res_name(&oi->oi_fid, name);
-       }
-}
-
 /**
  * Return true if the resource is for the object identified by this id & group.
  */
@@ -644,14 +631,15 @@ static inline void ost_fid_build_resid(const struct lu_fid *fid,
 }
 
 static inline void ost_fid_from_resid(struct lu_fid *fid,
-                                     const struct ldlm_res_id *name)
+                                     const struct ldlm_res_id *name,
+                                     int ost_idx)
 {
        if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_VER_OID_OFF])) {
                /* old resid */
                struct ost_id oi;
                ostid_set_seq(&oi, name->name[LUSTRE_RES_ID_VER_OID_OFF]);
                ostid_set_id(&oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
-               ostid_to_fid(fid, &oi, 0);
+               ostid_to_fid(fid, &oi, ost_idx);
        } else {
                /* new resid */
                fid_extract_from_res_name(fid, name);
@@ -688,9 +676,9 @@ static inline __u64 fid_flatten(const struct lu_fid *fid)
 
 static inline __u32 fid_hash(const struct lu_fid *f, int bits)
 {
-        /* all objects with same id and different versions will belong to same
-         * collisions list. */
-        return cfs_hash_long(fid_flatten(f), bits);
+       /* all objects with same id and different versions will belong to same
+        * collisions list. */
+       return hash_long(fid_flatten(f), bits);
 }
 
 /**
@@ -767,6 +755,27 @@ static inline void range_be_to_cpu(struct lu_seq_range *dst, const struct lu_seq
         dst->lsr_flags = be32_to_cpu(src->lsr_flags);
 }
 
+static inline void range_array_cpu_to_le(struct lu_seq_range_array *dst,
+                                        const struct lu_seq_range_array *src)
+{
+       int i;
+
+       for (i = 0; i < src->lsra_count; i++)
+               range_cpu_to_le(&dst->lsra_lsr[i], &src->lsra_lsr[i]);
+
+       dst->lsra_count = cpu_to_le32(src->lsra_count);
+}
+
+static inline void range_array_le_to_cpu(struct lu_seq_range_array *dst,
+                                        const struct lu_seq_range_array *src)
+{
+       int i;
+
+       dst->lsra_count = le32_to_cpu(src->lsra_count);
+       for (i = 0; i < dst->lsra_count; i++)
+               range_le_to_cpu(&dst->lsra_lsr[i], &src->lsra_lsr[i]);
+}
+
 /** @} fid */
 
 #endif /* __LUSTRE_FID_H */