summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-07-20 01:25:36 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-20 14:29:41 -0700
commit2add5760c412d85f56a1ca2fc61ca743d1ee2a74 (patch)
tree55977c6410496de0bfddb3c2c932b34ca6421b77 /libglusterfs
parent7b90b90780d3bb5a1b4a1c060fac1d2c4eb2a8dc (diff)
libglusterfsclient: Fake a fsid for every VMP
This is needed to work around the replicate behaviour of possibly returning device number for the same file from different subvolumes. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 148 (replicate: Returns st_dev from different subvols resulting in ESTALE thru unfs3booster) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=148
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/hashfn.c11
-rw-r--r--libglusterfs/src/hashfn.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/libglusterfs/src/hashfn.c b/libglusterfs/src/hashfn.c
index 9ef8955a8..d53ecb56a 100644
--- a/libglusterfs/src/hashfn.c
+++ b/libglusterfs/src/hashfn.c
@@ -33,6 +33,17 @@
#define DM_FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
#define DM_PARTROUNDS 6 /* 6 gets complete mixing */
+
+uint32_t
+ReallySimpleHash (char *path, int len)
+{
+ uint32_t hash = 0;
+ for (;len > 0; len--)
+ hash ^= (char)path[len];
+
+ return hash;
+}
+
/*
This is apparently the "fastest hash function for strings".
Written by Paul Hsieh <http://www.azillionmonkeys.com/qed/hash.html>
diff --git a/libglusterfs/src/hashfn.h b/libglusterfs/src/hashfn.h
index 92481126d..b8adcc6cc 100644
--- a/libglusterfs/src/hashfn.h
+++ b/libglusterfs/src/hashfn.h
@@ -32,4 +32,6 @@ uint32_t SuperFastHash (const char * data, int32_t len);
uint32_t gf_dm_hashfn (const char *msg, int len);
+uint32_t
+ReallySimpleHash (char *path, int len);
#endif /* __HASHFN_H__ */