summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c9
-rw-r--r--xlators/cluster/dht/src/tier.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index f1b0ecfeef0..027e74ac9f4 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -14,6 +14,7 @@
#include "config.h"
#endif
+#include "tier.h"
#include "dht-common.h"
#include "xlator.h"
#include <signal.h>
@@ -1180,6 +1181,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
gf_boolean_t clean_src = _gf_false;
gf_boolean_t clean_dst = _gf_false;
int log_level = GF_LOG_INFO;
+ gf_boolean_t delete_src_linkto = _gf_true;
defrag = conf->defrag;
if (!defrag)
@@ -1466,9 +1468,11 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* store size of previous migrated file */
if (defrag->tier_conf.is_tier) {
- if (from == conf->subvolumes[0]) {
+ if (from != TIER_HASHED_SUBVOL) {
defrag->tier_conf.st_last_promoted_size = stbuf.ia_size;
} else {
+ /* Don't delete the linkto file on the hashed subvol */
+ delete_src_linkto = _gf_false;
defrag->tier_conf.st_last_demoted_size = stbuf.ia_size;
}
}
@@ -1535,8 +1539,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
rcvd_enoent_from_src = 1;
}
+
if ((gf_uuid_compare (empty_iatt.ia_gfid, loc->gfid) == 0 ) &&
- (!rcvd_enoent_from_src)) {
+ (!rcvd_enoent_from_src) && delete_src_linkto) {
/* take out the source from namespace */
ret = syncop_unlink (from, loc, NULL, NULL);
if (ret) {
diff --git a/xlators/cluster/dht/src/tier.h b/xlators/cluster/dht/src/tier.h
index 8087eee87b3..1f9f2da04e6 100644
--- a/xlators/cluster/dht/src/tier.h
+++ b/xlators/cluster/dht/src/tier.h
@@ -38,6 +38,8 @@
#define PROMOTION_QFILE "promotequeryfile"
#define DEMOTION_QFILE "demotequeryfile"
+#define TIER_HASHED_SUBVOL conf->subvolumes[1]
+
#define GET_QFILE_PATH(is_promotion)\
(is_promotion) ? promotion_qfile : demotion_qfile