summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/dht/src/dht-common.h1
-rw-r--r--xlators/cluster/dht/src/dht-hashfn.c1
-rw-r--r--xlators/cluster/dht/src/dht-layout.c8
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c8
4 files changed, 15 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 28deaefc6..d3ccacdb8 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -60,6 +60,7 @@ typedef struct dht_layout dht_layout_t;
typedef enum {
DHT_HASH_TYPE_DM,
+ DHT_HASH_TYPE_DM_USER,
} dht_hashfn_type_t;
/* rebalance related */
diff --git a/xlators/cluster/dht/src/dht-hashfn.c b/xlators/cluster/dht/src/dht-hashfn.c
index 98756157d..97eb1f05f 100644
--- a/xlators/cluster/dht/src/dht-hashfn.c
+++ b/xlators/cluster/dht/src/dht-hashfn.c
@@ -28,6 +28,7 @@ dht_hash_compute_internal (int type, const char *name, uint32_t *hash_p)
switch (type) {
case DHT_HASH_TYPE_DM:
+ case DHT_HASH_TYPE_DM_USER:
hash = gf_dm_hashfn (name, strlen (name));
break;
default:
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c
index 08697d042..97bbe987f 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -308,9 +308,13 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout,
return -1;
}
- switch (disk_layout[1]) {
+ type = ntoh32 (disk_layout[1]);
+ switch (type) {
+ case DHT_HASH_TYPE_DM_USER:
+ gf_log (this->name, GF_LOG_DEBUG, "found user-set layout");
+ layout->type = type;
+ /* Fall through. */
case DHT_HASH_TYPE_DM:
- type = ntoh32 (disk_layout[1]);
break;
default:
gf_log (this->name, GF_LOG_CRITICAL,
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 68d9416fa..7ceb80157 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -576,6 +576,12 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
priv = this->private;
local = frame->local;
+ if (layout->type == DHT_HASH_TYPE_DM_USER) {
+ gf_log (THIS->name, GF_LOG_DEBUG, "leaving %s alone",
+ loc->path);
+ goto done;
+ }
+
count = cnt = dht_get_layout_count (this, layout, 0);
chunk = ((unsigned long) 0xffffffff) / ((cnt) ? cnt : 1);
@@ -700,7 +706,7 @@ done:
if (fix_array)
GF_FREE (fix_array);
- return new_layout;
+ return local->layout;
}