Whamcloud - gitweb
- more fixes with hash_segment calculation. make them similar during split and
authortappro <tappro>
Fri, 3 Nov 2006 12:39:07 +0000 (12:39 +0000)
committertappro <tappro>
Fri, 3 Nov 2006 12:39:07 +0000 (12:39 +0000)
  at client after that.
- fix cmr_link() issue. use correct place to store fid during lookup

lustre/cmm/cmm_object.c
lustre/cmm/cmm_split.c
lustre/include/lustre/lustre_idl.h
lustre/obdclass/mea.c

index 29b7966..86811a8 100644 (file)
@@ -874,12 +874,13 @@ static int cmr_link(const struct lu_env *env, struct md_object *mo_p,
                     struct md_object *mo_s, const char *name,
                     struct md_attr *ma)
 {
+        struct cmm_thread_info *cmi;
         int rc;
         ENTRY;
-
+        
+        cmi = cmm_env_info(env);
         /* make sure that name isn't exist before doing remote call */
-        rc = mdo_lookup(env, md_object_next(mo_p), name,
-                        lu_object_fid(&mo_s->mo_lu));
+        rc = mdo_lookup(env, md_object_next(mo_p), name, &cmi->cmi_fid);
         if (rc == 0)
                 rc = -EEXIST;
         else if (rc == -ENOENT) {
index 9b60ace..2bc5c06 100644 (file)
@@ -617,7 +617,7 @@ static int cmm_split_process_dir(const struct lu_env *env,
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct lu_rdpg *rdpg = &cmm_env_info(env)->cmi_rdpg;
-        __u32 hash_segement;
+        __u64 hash_segement = (__u64)(MAX_HASH_SIZE + 1);
         int rc = 0, i;
         ENTRY;
 
@@ -634,20 +634,20 @@ static int cmm_split_process_dir(const struct lu_env *env,
 
         LASSERT(ma->ma_valid & MA_LMV);
         /* we need range of hashes, so MAX_HASH_SIZE + 1 */
-        hash_segement = (MAX_HASH_SIZE + 1) / (cmm->cmm_tgt_count + 1);
+        do_div(hash_segement, cmm->cmm_tgt_count + 1);
         for (i = 1; i < cmm->cmm_tgt_count + 1; i++) {
                 struct lu_fid *lf;
                 __u32 hash_end;
 
                 lf = &ma->ma_lmv->mea_ids[i];
 
-                rdpg->rp_hash = i * hash_segement;
+                rdpg->rp_hash = (__u32)(i * hash_segement);
                 /* for last stripe we should use MAX_HASH_SIZE + 1 as end
                  * to don't lost latest hashed */
                 if (i == cmm->cmm_tgt_count) 
-                        hash_end = MAX_HASH_SIZE + 1;
+                        hash_end = (__u32)(MAX_HASH_SIZE + 1);
                 else
-                        hash_end = rdpg->rp_hash + hash_segement;
+                        hash_end = (__u32)((i + 1) * hash_segement);
                 rc = cmm_split_process_stripe(env, mo, rdpg, lf, hash_end);
                 if (rc) {
                         CERROR("Error (rc = %d) while splitting for %d: fid="
index 6d642ad..bee576b 100644 (file)
@@ -330,7 +330,7 @@ static inline int lu_dirent_size(struct lu_dirent *ent)
 #define MEA_MAGIC_ALL_CHARS      0xb222a11c
 #define MEA_MAGIC_HASH_SEGMENT   0xb222a11b
 
-#define MAX_HASH_SIZE            0x7fffffff
+#define MAX_HASH_SIZE            0x7fffffffUL
 #define MAX_HASH_HIGHEST_BIT     0x10000000
 
 /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
index 030cf61..24dde7f 100644 (file)
@@ -101,7 +101,7 @@ static __u32 hash_build(char *name, int namelen)
 static int mea_hash_segment(int count, char *name, int namelen)
 {
         __u64 hash;
-        __u64 hash_segment = MAX_HASH_SIZE;
+        __u64 hash_segment = MAX_HASH_SIZE + 1;
 
         hash = hash_build(name, namelen);
         do_div(hash_segment, count);