diff options
author | Venkatesh Somyajulu <vsomyaju@redhat.com> | 2014-06-17 14:45:44 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-06-17 05:26:27 -0700 |
commit | 3a499d170de2c7df06b127b709d27c64cef98886 (patch) | |
tree | 7cdc8d50872c788d2d1051e3fc9c20d6513ccda7 /xlators/cluster/dht/src/dht-selfheal.c | |
parent | e232b4c674dad697bb520c34fa4c445d0ababfc3 (diff) |
cluster/dht: Bring option to choose gfid or name based hashing
Change-Id: I11794eb2adceb88e75864aede450e904431a6273
BUG: 1095888
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/8049
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-selfheal.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 84b0f2f4679..04e58903147 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -566,16 +566,26 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, return 0; } - int dht_selfheal_layout_alloc_start (xlator_t *this, loc_t *loc, dht_layout_t *layout) { - int start = 0; - uint32_t hashval = 0; - int ret = 0; + int start = 0; + uint32_t hashval = 0; + int ret = 0; + const char *str = NULL; + dht_conf_t *conf = NULL; + char buf[UUID_CANONICAL_FORM_LEN + 1] = {0, }; + + conf = this->private; + + if (conf->randomize_by_gfid) { + str = uuid_utoa_r (loc->gfid, buf); + } else { + str = loc->path; + } - ret = dht_hash_compute (this, layout->type, loc->path, &hashval); + ret = dht_hash_compute (this, layout->type, str, &hashval); if (ret == 0) { start = (hashval % layout->cnt); } |