summaryrefslogtreecommitdiffstats
path: root/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-06-20 14:38:12 +0530
committerDan Lambright <dlambrig@redhat.com>2015-06-26 16:05:20 -0700
commit26ef697318a7fec5ed82b000e3be4e30cfb16b50 (patch)
treea83e0c745e12016482bffb883361e507dd04275f /xlators/features/changetimerecorder/src/ctr-xlator-ctx.c
parent254218fa39d9317f759b4bfb4433478586eda0e3 (diff)
tier/ctr: Ignore creation of T file and Ctr Lookup heal improvememnts
1) Ignore creation of T file in ctr_mknod 2) Ignore lookup for T file in ctr_lookup 3) Ctr_lookup: a. If the gfid and pgfid in empty dont record b. Decreased log level for multiple heal attempts c. Inode/File heal happens after an expiry period, which is configurable. d. Hardlink heal happens after an expiry period, which is configurable. Change-Id: Id8eb5092e78beaec22d05f5283645081619e2452 BUG: 1235269 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/11334 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/features/changetimerecorder/src/ctr-xlator-ctx.c')
-rw-r--r--xlators/features/changetimerecorder/src/ctr-xlator-ctx.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c
index a91a2bbefc0..b8f6f0301d9 100644
--- a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c
+++ b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c
@@ -10,6 +10,8 @@
#include "ctr-xlator-ctx.h"
#include "ctr-messages.h"
+#include <time.h>
+#include <sys/time.h>
#define IS_THE_ONLY_HARDLINK(ctr_hard_link)\
(ctr_hard_link->list.next == ctr_hard_link->list.prev)
@@ -63,13 +65,14 @@ out:
/* Please lock the ctr_xlator_ctx before using this function */
int
-ctr_add_hard_link (xlator_t *this,
+ctr_add_hard_link (xlator_t *this,
ctr_xlator_ctx_t *ctr_xlator_ctx,
uuid_t pgfid,
const char *base_name)
{
int ret = -1;
ctr_hard_link_t *ctr_hard_link = NULL;
+ struct timeval current_time = {0};
GF_ASSERT (this);
GF_ASSERT (ctr_xlator_ctx);
@@ -98,10 +101,19 @@ ctr_add_hard_link (xlator_t *this,
goto error;
}
+ ret = gettimeofday (&current_time, NULL);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get current time");
+ goto error;
+ }
+
/*Add the hard link to the list*/
list_add_tail (&ctr_hard_link->list,
&ctr_xlator_ctx->hardlink_list);
+ ctr_hard_link->hardlink_heal_period = current_time.tv_sec;
+
/*aal izz well!*/
ret = 0;
goto out;
@@ -169,8 +181,9 @@ ctr_update_hard_link (xlator_t *this,
uuid_t old_pgfid,
const char *old_base_name)
{
- int ret = -1;
+ int ret = -1;
ctr_hard_link_t *ctr_hard_link = NULL;
+ struct timeval current_time = {0};
GF_ASSERT (this);
GF_ASSERT (ctr_xlator_ctx);
@@ -212,6 +225,15 @@ ctr_update_hard_link (xlator_t *this,
goto out;
}
+ ret = gettimeofday (&current_time, NULL);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get current time");
+ ctr_hard_link->hardlink_heal_period = 0;
+ } else {
+ ctr_hard_link->hardlink_heal_period = current_time.tv_sec;
+ }
+
ret = 0;
out:
@@ -284,6 +306,7 @@ init_ctr_xlator_ctx (xlator_t *this,
int ret = -1;
uint64_t _addr = 0;
ctr_xlator_ctx_t *ctr_xlator_ctx = NULL;
+ struct timeval current_time = {0};
GF_ASSERT (this);
GF_ASSERT (inode);
@@ -316,6 +339,14 @@ init_ctr_xlator_ctx (xlator_t *this,
INIT_LIST_HEAD (&ctr_xlator_ctx->hardlink_list);
+ ret = gettimeofday (&current_time, NULL);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get current time");
+ goto out;
+ }
+
+ ctr_xlator_ctx->inode_heal_period = current_time.tv_sec;
}
ret = 0;
out: