diff options
Diffstat (limited to 'xlators/features/marker/src/marker.c')
-rw-r--r-- | xlators/features/marker/src/marker.c | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index b51b9ccc9f5..3094c68791b 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -3193,9 +3193,9 @@ mem_acct_init (xlator_t *this) int32_t init_xtime_priv (xlator_t *this, dict_t *options) { - data_t *data = NULL; int32_t ret = -1; marker_conf_t *priv = NULL; + char *tmp_opt = NULL; GF_VALIDATE_OR_GOTO ("marker", this, out); GF_VALIDATE_OR_GOTO (this->name, options, out); @@ -3203,29 +3203,11 @@ init_xtime_priv (xlator_t *this, dict_t *options) priv = this->private; - if((data = dict_get (options, VOLUME_UUID)) != NULL) { - priv->volume_uuid = data->data; + ret = dict_get_str (options, "volume-uuid", &tmp_opt); - ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); - if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, - "invalid volume uuid %s", priv->volume_uuid); - goto out; - } - - ret = gf_asprintf (& (priv->marker_xattr), "%s.%s.%s", - MARKER_XATTR_PREFIX, priv->volume_uuid, - XTIME); - - if (ret == -1){ - priv->marker_xattr = NULL; - goto out; - } - - gf_log (this->name, GF_LOG_DEBUG, - "volume-uuid = %s", priv->volume_uuid); - } else { + if (ret) { priv->volume_uuid = NULL; + tmp_opt = ""; gf_log (this->name, GF_LOG_ERROR, "please specify the volume-uuid" @@ -3233,16 +3215,32 @@ init_xtime_priv (xlator_t *this, dict_t *options) return -1; } + gf_asprintf (&priv->volume_uuid, "%s", tmp_opt); - if ((data = dict_get (options, TIMESTAMP_FILE)) != NULL) { - priv->timestamp_file = data->data; + ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); - gf_log (this->name, GF_LOG_DEBUG, - "the timestamp-file is = %s", - priv->timestamp_file); + if (ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "invalid volume uuid %s", priv->volume_uuid); + goto out; + } - } else { + ret = gf_asprintf (&(priv->marker_xattr), "%s.%s.%s", + MARKER_XATTR_PREFIX, priv->volume_uuid, + XTIME); + + if (ret == -1) { + priv->marker_xattr = NULL; + goto out; + } + + gf_log (this->name, GF_LOG_DEBUG, + "volume-uuid = %s", priv->volume_uuid); + + ret = dict_get_str (options, "timestamp-file", &tmp_opt); + if (ret) { priv->timestamp_file = NULL; + tmp_opt = ""; gf_log (this->name, GF_LOG_ERROR, "please specify the timestamp-file" @@ -3251,6 +3249,15 @@ init_xtime_priv (xlator_t *this, dict_t *options) goto out; } + ret = gf_asprintf (&priv->timestamp_file, "%s", tmp_opt); + if (ret == -1) { + priv->timestamp_file = NULL; + goto out; + } + + gf_log (this->name, GF_LOG_DEBUG, + "the timestamp-file is = %s", priv->timestamp_file); + ret = 0; out: return ret; @@ -3292,6 +3299,12 @@ marker_priv_cleanup (xlator_t *this) LOCK_DESTROY (&priv->lock); GF_FREE (priv); + + if (this->local_pool) { + mem_pool_destroy (this->local_pool); + this->local_pool = NULL; + } + out: return; } |