summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/dht/src/dht-common.c15
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c7
-rw-r--r--xlators/cluster/dht/src/tier.c18
3 files changed, 34 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 2122839c020..e9eec37e6e4 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3431,6 +3431,21 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
if (local->rebalance.target_node) {
local->flags = forced_rebalance;
+ /* Flag to suggest its a tiering migration
+ * The reason for this dic key-value is that
+ * promotions and demotions are multithreaded
+ * so the original frame from gf_defrag_start()
+ * is not carried. A new frame will be created when
+ * we do syncop_setxattr(). This doesnot have the
+ * frame->root->pid of the original frame. So we pass
+ * this dic key-value when we do syncop_setxattr() to do
+ * data migration and set the frame->root->pid to
+ * GF_CLIENT_PID_TIER_DEFRAG in dht_setxattr() just before
+ * calling dht_start_rebalance_task() */
+ tmp = dict_get (xattr, "tiering.migration");
+ if (tmp)
+ frame->root->pid = GF_CLIENT_PID_TIER_DEFRAG;
+
ret = dht_start_rebalance_task (this, frame);
if (!ret)
return 0;
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 5e9f4d6e1a6..11b63c8ee01 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2711,12 +2711,7 @@ gf_defrag_start (void *data)
if (!frame)
goto out;
- /* If its a tiering rebalancer mark it seperately so that CTR Xlator
- * can take appropriate action */
- if (defrag->cmd == GF_DEFRAG_CMD_START_TIER)
- frame->root->pid = GF_CLIENT_PID_TIER_DEFRAG;
- else
- frame->root->pid = GF_CLIENT_PID_DEFRAG;
+ frame->root->pid = GF_CLIENT_PID_DEFRAG;
defrag->pid = frame->root->pid;
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 0663a7fb1cb..5be919800c2 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -219,6 +219,24 @@ tier_migrate_using_query_file (void *_args)
if (per_file_status) {
goto per_file_out;
}
+
+ /* Flag to suggest its a tiering migration
+ * The reason for this dic key-value is that
+ * promotions and demotions are multithreaded
+ * so the original frame from gf_defrag_start()
+ * is not carried. A new frame will be created when
+ * we do syncop_setxattr(). This doesnot have the
+ * frame->root->pid of the original frame. So we pass
+ * this dic key-value when we do syncop_setxattr() to do
+ * data migration and set the frame->root->pid to
+ * GF_CLIENT_PID_TIER_DEFRAG in dht_setxattr() just before
+ * calling dht_start_rebalance_task() */
+ per_file_status = dict_set_str (migrate_data,
+ "tiering.migration", "yes");
+ if (per_file_status) {
+ goto per_file_out;
+ }
+
}
per_link_status = 0;
/* Per link of file */