summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschaffung <ssivakum@redhat.com>2021-01-18 10:29:42 +0530
committerGitHub <noreply@github.com>2021-01-18 10:29:42 +0530
commit3813ffafb12d20d2b728d43b3f0eb5201e6fb7c2 (patch)
treef44264ab5b43f3872c04c21d7b6b2388e085bcb0
parentbc38c4ccf2d00225313d531ba1059e9d9ae59b83 (diff)
downloadglusterfs-3813ffafb12d20d2b728d43b3f0eb5201e6fb7c2.tar.gz
glusterfs-3813ffafb12d20d2b728d43b3f0eb5201e6fb7c2.tar.xz
glusterfs-3813ffafb12d20d2b728d43b3f0eb5201e6fb7c2.zip
glusterd: Removing redundant NULL checks for this and other cleanups. (#1735)
* glusterd: Removing redundant NULL checks for this Issue: It has been noticed that the NULL checks performed on `this` are actually being done on `THIS` as `this` is derived from `THIS`. If the `THIS` had been NULL, the crash would have happened before itself. Fix: Basically removing the validations and assertion functions which check if `this` is NULL. Fixes: #1596 Signed-off-by: srijan-sivakumar <ssivakum@redhat.com> * Made changes wrt review comments received. Fixes: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * glusterd: The efficient usage of `THIS` and `this`. This commit addresses the review comments and tries to change code in more places wherein the `THIS` and `this` can be handled efficiently. Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * Updated commit to address review comments. Updates: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * Addressing Review comments. Updates: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * Made changes after regression failure. Updates: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * One has to be careful while working with c Instead of a `||` operation, the cleanup left out with `|`. Does the compiler ceck for these things? Updates: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> * Fixing clang-format issues. Change-Id: I68c52249af66080f59f57e558901f2654bd43cd8 Updates: #1596 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> Co-authored-by: srijan-sivakumar <ssivakumar@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitd-svc.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c60
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c91
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c38
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c326
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c36
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c172
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c51
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c24
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c65
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-log-ops.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c74
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c137
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c238
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.c58
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c17
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c113
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quotad-svc.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c66
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-reset-brick.c10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c110
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-scrub-svc.c17
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-server-quorum.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-shd-svc.c29
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c30
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapd-svc.c23
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c206
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c372
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-statedump.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c159
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c32
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c29
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c70
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c697
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c268
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c135
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c99
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c21
44 files changed, 1009 insertions, 2971 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
index 6adb799b18..a3a36d8332 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
@@ -38,9 +38,8 @@ glusterd_bitdsvc_create_volfile()
};
int ret = -1;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -51,12 +50,9 @@ glusterd_bitdsvc_create_volfile()
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create volfile");
- goto out;
}
-out:
gf_msg_debug(this->name, 0, "Returning %d", ret);
-
return ret;
}
@@ -64,10 +60,7 @@ int
glusterd_bitdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
{
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!svc->inited) {
ret = glusterd_bitdsvc_init(svc);
@@ -108,7 +101,7 @@ out:
if (ret)
gf_event(EVENT_SVC_MANAGER_FAILED, "svc_name=%s", svc->name);
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -145,13 +138,10 @@ int
glusterd_bitdsvc_reconfigure()
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t identical = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -201,6 +191,6 @@ manager:
ret = priv->bitd_svc.manager(&(priv->bitd_svc), NULL, PROC_START_NO_WAIT);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
index 37429fe921..d4253d7b0e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
@@ -52,14 +52,11 @@ __glusterd_handle_bitrot(rpcsvc_request_t *req)
char msg[256] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -195,10 +192,7 @@ glusterd_bitrot_scrub_throttle(glusterd_volinfo_t *volinfo, dict_t *dict,
int32_t ret = -1;
char *scrub_throttle = NULL;
char *option = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_str(dict, "scrub-throttle-value", &scrub_throttle);
if (ret) {
@@ -234,12 +228,9 @@ glusterd_bitrot_scrub_freq(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
int32_t ret = -1;
char *scrub_freq = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *option = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_str(dict, "scrub-frequency-value", &scrub_freq);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
@@ -274,12 +265,9 @@ glusterd_bitrot_scrub(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
int32_t ret = -1;
char *scrub_value = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *option = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_str(dict, "scrub-value", &scrub_value);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -319,14 +307,11 @@ glusterd_bitrot_expiry_time(glusterd_volinfo_t *volinfo, dict_t *dict,
{
int32_t ret = -1;
uint32_t expiry_time = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char dkey[32] = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_uint32(dict, "expiry-time", &expiry_time);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
@@ -385,15 +370,12 @@ glusterd_bitrot_signer_threads(glusterd_volinfo_t *volinfo, dict_t *dict,
int32_t ret = -1;
uint32_t signer_th_count = 0;
uint32_t existing_th_count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char dkey[32] = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -434,10 +416,7 @@ static int
glusterd_bitrot_enable(glusterd_volinfo_t *volinfo, char **op_errstr)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, op_errstr, out);
@@ -487,10 +466,7 @@ static int
glusterd_bitrot_disable(glusterd_volinfo_t *volinfo, char **op_errstr)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, op_errstr, out);
@@ -526,14 +502,11 @@ out:
gf_boolean_t
glusterd_should_i_stop_bitd()
{
- glusterd_conf_t *conf = THIS->private;
+ xlator_t *this = THIS;
+ glusterd_conf_t *conf = this->private;
glusterd_volinfo_t *volinfo = NULL;
gf_boolean_t stopped = _gf_true;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
cds_list_for_each_entry(volinfo, &conf->volumes, vol_list)
{
@@ -564,12 +537,9 @@ static int
glusterd_manage_bitrot(int opcode)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -599,13 +569,11 @@ glusterd_op_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char *volname = NULL;
int type = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -727,12 +695,10 @@ glusterd_op_stage_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
0,
};
int type = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index d3cf76d0c9..84760cf473 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -165,9 +165,6 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo,
{
int ret = -1;
int replica_nodes = 0;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
switch (volinfo->type) {
case GF_CLUSTER_TYPE_NONE:
@@ -176,7 +173,7 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo,
"replica count (%d) option given for non replicate "
"volume %s",
replica_count, volinfo->volname);
- gf_smsg(this->name, GF_LOG_WARNING, EINVAL, GD_MSG_INVALID_ARGUMENT,
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL, GD_MSG_INVALID_ARGUMENT,
err_str, NULL);
goto out;
@@ -188,7 +185,7 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo,
"than volume %s's replica count (%d)",
replica_count, volinfo->volname,
volinfo->replica_count);
- gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL,
GD_MSG_INVALID_ARGUMENT, err_str, NULL);
goto out;
}
@@ -203,7 +200,7 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo,
"(or %dxN)",
brick_count, volinfo->dist_leaf_count,
volinfo->dist_leaf_count);
- gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL,
GD_MSG_INVALID_ARGUMENT, err_str, NULL);
goto out;
}
@@ -219,7 +216,7 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo,
"need %d(xN) bricks for reducing replica "
"count of the volume from %d to %d",
replica_nodes, volinfo->replica_count, replica_count);
- gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL,
GD_MSG_INVALID_ARGUMENT, err_str, NULL);
goto out;
}
@@ -249,16 +246,13 @@ __glusterd_handle_add_brick(rpcsvc_request_t *req)
0,
};
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int total_bricks = 0;
int32_t replica_count = 0;
int32_t arbiter_count = 0;
int type = 0;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(req);
conf = this->private;
@@ -491,7 +485,6 @@ subvol_matcher_verify(int *subvols, glusterd_volinfo_t *volinfo, char *err_str,
int ret = 0;
int count = volinfo->replica_count - replica_count;
xlator_t *this = THIS;
- GF_ASSERT(this);
if (replica_count && subvols) {
for (i = 0; i < volinfo->subvol_count; i++) {
@@ -542,9 +535,7 @@ glusterd_remove_brick_validate_arbiters(glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_brickinfo_t *last = NULL;
char *arbiter_array = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (volinfo->type != GF_CLUSTER_TYPE_REPLICATE)
goto out;
@@ -627,12 +618,10 @@ __glusterd_handle_remove_brick(rpcsvc_request_t *req)
char vol_type[256] = "";
int32_t replica_count = 0;
char *volname = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int cmd = -1;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -995,7 +984,7 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
int brickid = 0;
char key[64] = "";
char *brick_mount_dir = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_boolean_t is_valid_add_brick = _gf_false;
gf_boolean_t restart_shd = _gf_false;
@@ -1003,8 +992,6 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
0,
};
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volinfo);
conf = this->private;
@@ -1022,16 +1009,16 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
ret = dict_get_int32n(dict, "replica-count", SLEN("replica-count"),
&replica_count);
if (!ret)
- gf_msg(THIS->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
+ gf_msg(this->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
"replica-count is set %d", replica_count);
ret = dict_get_int32n(dict, "arbiter-count", SLEN("arbiter-count"),
&arbiter_count);
if (!ret)
- gf_msg(THIS->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
+ gf_msg(this->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
"arbiter-count is set %d", arbiter_count);
ret = dict_get_int32n(dict, "type", SLEN("type"), &type);
if (!ret)
- gf_msg(THIS->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
+ gf_msg(this->name, GF_LOG_INFO, errno, GD_MSG_DICT_GET_SUCCESS,
"type is set %d, need to change it", type);
}
@@ -1149,7 +1136,7 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
if (volinfo->status == GLUSTERD_STATUS_STARTED) {
ret = volinfo->shd.svc.stop(&(volinfo->shd.svc), SIGTERM);
if (ret) {
- gf_msg("glusterd", GF_LOG_ERROR, 0,
+ gf_msg(this->name, GF_LOG_ERROR, 0,
GD_MSG_GLUSTER_SERVICES_STOP_FAIL,
"Failed to stop shd for %s.", volinfo->volname);
}
@@ -1157,7 +1144,7 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
}
ret = generate_dummy_client_volfiles(volinfo);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create volfile.");
goto out;
}
@@ -1173,7 +1160,7 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
if (gf_uuid_is_null(brickinfo->uuid)) {
ret = glusterd_resolve_brick(brickinfo);
if (ret) {
- gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_RESOLVE_BRICK_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_RESOLVE_BRICK_FAIL,
FMTSTR_RESOLVE_BRICK, brickinfo->hostname,
brickinfo->path);
goto out;
@@ -1199,7 +1186,7 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count,
* the restart_needed flag. */
if ((!gf_uuid_compare(brickinfo->uuid, MY_UUID)) && !restart_needed) {
restart_needed = 1;
- gf_msg_debug("glusterd", 0,
+ gf_msg_debug(this->name, 0,
"Restart gsyncd session, if it's already "
"running.");
}
@@ -1232,13 +1219,13 @@ out:
if (restart_shd) {
if (volinfo->shd.svc.manager(&(volinfo->shd.svc), volinfo,
PROC_START_NO_WAIT)) {
- gf_msg("glusterd", GF_LOG_CRITICAL, 0,
+ gf_msg(this->name, GF_LOG_CRITICAL, 0,
GD_MSG_GLUSTER_SERVICE_START_FAIL,
"Failed to start shd for %s.", volinfo->volname);
}
}
- gf_msg_debug("glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1248,14 +1235,10 @@ glusterd_op_perform_remove_brick(glusterd_volinfo_t *volinfo, char *brick,
{
glusterd_brickinfo_t *brickinfo = NULL;
int32_t ret = -1;
- glusterd_conf_t *priv = NULL;
GF_ASSERT(volinfo);
GF_ASSERT(brick);
- priv = THIS->private;
- GF_ASSERT(priv);
-
ret = glusterd_volume_brickinfo_get_by_brick(brick, volinfo, &brickinfo,
_gf_false);
if (ret)
@@ -1308,7 +1291,7 @@ glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char *brick = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char msg[4096] = "";
char key[64] = "";
gf_boolean_t brick_alloc = _gf_false;
@@ -1318,8 +1301,6 @@ glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
glusterd_conf_t *conf = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1652,10 +1633,9 @@ glusterd_remove_brick_validate_bricks(gf1_op_commands cmd, int32_t brick_count,
char pidfile[PATH_MAX + 1] = {
0,
};
- glusterd_conf_t *priv = THIS->private;
- int pid = -1;
xlator_t *this = THIS;
- GF_ASSERT(this);
+ glusterd_conf_t *priv = this->private;
+ int pid = -1;
/* Check whether all the nodes of the bricks to be removed are
* up, if not fail the operation */
@@ -1789,14 +1769,11 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
int32_t flag = 0;
gf1_op_commands cmd = GF_OP_CMD_NONE;
char *task_id_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gsync_status_param_t param = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
ret = op_version_check(this, GD_OP_VER_PERSISTENT_AFR_XATTRS, msg,
sizeof(msg));
if (ret) {
@@ -2130,17 +2107,10 @@ glusterd_op_add_brick(dict_t *dict, char **op_errstr)
{
int ret = 0;
char *volname = NULL;
- glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
char *bricks = NULL;
int32_t count = 0;
-
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
- GF_ASSERT(priv);
+ glusterd_conf_t *priv = THIS->private;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
@@ -2243,12 +2213,9 @@ glusterd_set_rebalance_id_for_remove_brick(dict_t *req_dict, dict_t *rsp_dict)
glusterd_volinfo_t *volinfo = NULL;
char msg[2048] = {0};
char *task_id_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t cmd = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(rsp_dict);
GF_ASSERT(req_dict);
@@ -2329,7 +2296,7 @@ glusterd_op_remove_brick(dict_t *dict, char **op_errstr)
gf1_op_commands cmd = 0;
int32_t replica_count = 0;
char *task_id_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *bricks_dict = NULL;
char *brick_tmpstr = NULL;
int start_remove = 0;
@@ -2337,8 +2304,6 @@ glusterd_op_remove_brick(dict_t *dict, char **op_errstr)
int defrag_cmd = 0;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -2634,14 +2599,12 @@ int
glusterd_op_stage_barrier(dict_t *dict, char **op_errstr)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volname = NULL;
glusterd_volinfo_t *vol = NULL;
char *barrier_op = NULL;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
@@ -2685,14 +2648,12 @@ int
glusterd_op_barrier(dict_t *dict, char **op_errstr)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volname = NULL;
glusterd_volinfo_t *vol = NULL;
char *barrier_op = NULL;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
index 5c01f0c70b..024b680547 100644
--- a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
@@ -26,12 +26,6 @@ glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, int frame_timeout,
xlator_t *this = THIS;
glusterd_svc_t *svc = NULL;
- if (!this) {
- gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_XLATOR_NOT_DEFINED,
- NULL);
- goto out;
- }
-
options = dict_new();
if (!options) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 094a682e75..544b148987 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -157,11 +157,9 @@ glusterd_is_ganesha_cluster()
{
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t ret_bool = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("ganesha", this, out);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -254,11 +252,9 @@ glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
char *value = NULL;
char *str = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -280,13 +276,13 @@ glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
if (strcmp(value, "enable") == 0) {
ret = start_ganesha(op_errstr);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_NFS_GNS_START_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_NFS_GNS_START_FAIL,
"Could not start NFS-Ganesha");
}
} else {
ret = stop_ganesha(op_errstr);
if (ret)
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"Could not stop "
"NFS-Ganesha.");
}
@@ -309,14 +305,12 @@ int
glusterd_op_set_ganesha(dict_t *dict, char **errstr)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char *key = NULL;
char *value = NULL;
char *next_version = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
priv = this->private;
@@ -353,7 +347,7 @@ glusterd_op_set_ganesha(dict_t *dict, char **errstr)
}
ret = glusterd_get_next_global_opt_version_str(priv->opts, &next_version);
if (ret) {
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"Could not fetch "
" global op version");
goto out;
@@ -389,10 +383,9 @@ check_host_list(void)
glusterd_conf_t *priv = NULL;
char *hostname, *hostlist;
gf_boolean_t ret = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- priv = THIS->private;
+ priv = this->private;
GF_ASSERT(priv);
hostlist = parsing_ganesha_ha_conf("HA_CLUSTER_NODES");
@@ -480,12 +473,10 @@ ganesha_manage_export(dict_t *dict, char *value,
glusterd_volinfo_t *volinfo = NULL;
dict_t *vol_opts = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t option = _gf_false;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(value);
@@ -710,10 +701,11 @@ teardown(gf_boolean_t run_teardown, char **op_errstr)
};
int ret = 1;
glusterd_volinfo_t *volinfo = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
dict_t *vol_opts = NULL;
- priv = THIS->private;
+ priv = this->private;
ret = tear_down_cluster(run_teardown);
if (ret == -1) {
@@ -728,7 +720,7 @@ teardown(gf_boolean_t run_teardown, char **op_errstr)
CONFDIR, NULL);
ret = runner_run(&runner);
if (ret)
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"Could not clean up"
" NFS-Ganesha related config");
@@ -739,21 +731,21 @@ teardown(gf_boolean_t run_teardown, char **op_errstr)
unexported, hence setting the appropriate keys */
ret = dict_set_str(vol_opts, "features.cache-invalidation", "off");
if (ret)
- gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
"Could not set features.cache-invalidation "
"to off for %s",
volinfo->volname);
ret = dict_set_str(vol_opts, "ganesha.enable", "off");
if (ret)
- gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
"Could not set ganesha.enable to off for %s",
volinfo->volname);
ret = glusterd_store_volinfo(volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret)
- gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_SET_FAIL,
"failed to store volinfo for %s", volinfo->volname);
}
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 84bc669b64..408397faa5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -73,12 +73,10 @@ static char *gsync_no_restart_opts[] = {"checkpoint", "log_rsync_performance",
void
set_gsyncd_inet6_arg(runner_t *runner)
{
- xlator_t *this = NULL;
char *af;
int ret;
- this = THIS;
- ret = dict_get_str(this->options, "transport.address-family", &af);
+ ret = dict_get_str(THIS->options, "transport.address-family", &af);
if (ret == 0)
runner_argprintf(runner, "--%s", af);
}
@@ -97,12 +95,10 @@ __glusterd_handle_sys_exec(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -180,12 +176,10 @@ __glusterd_handle_copy_file(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -266,12 +260,10 @@ __glusterd_handle_gsync_set(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -430,7 +422,7 @@ static int32_t
parse_secondary_url(char *sec_url, char **secondary)
{
char *tmp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t ret = -1;
this = THIS;
@@ -469,12 +461,9 @@ _glusterd_urltransform_add_iter(dict_t *dict, char *key, data_t *value,
runner_t *runner = (runner_t *)data;
char sec_url[VOLINFO_SECONDARY_URL_MAX] = {0};
char *secondary = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
gf_msg_debug(this->name, 0, "value->data %s", value->data);
if (snprintf(sec_url, sizeof(sec_url), "%s", value->data) >=
@@ -516,10 +505,7 @@ glusterd_urltransform(runner_t *runner, char ***linearrp)
unsigned arr_len = 32;
unsigned arr_idx = 0;
gf_boolean_t error = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
linearr = GF_CALLOC(arr_len, sizeof(char *), gf_gld_mt_linearr);
if (!linearr) {
@@ -694,10 +680,7 @@ glusterd_query_extutil_generic(char *resbuf, size_t blen, runner_t *runner,
void *data))
{
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
runner_redir(runner, STDOUT_FILENO, RUN_PIPE);
if (runner_start(runner) != 0) {
@@ -748,12 +731,9 @@ glusterd_get_secondary_voluuid(char *secondary_host, char *secondary_vol,
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -994,12 +974,9 @@ gsyncd_getpidfile(char *primary, char *secondary, char *pidfile,
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(this->private);
GF_ASSERT(conf_path);
@@ -1107,10 +1084,7 @@ glusterd_gsync_volinfo_dict_set(glusterd_volinfo_t *volinfo, char *key,
{
int32_t ret = -1;
char *gsync_status = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
gsync_status = gf_strdup(value);
if (!gsync_status) {
@@ -1138,10 +1112,7 @@ glusterd_verify_gsyncd_spawn(char *primary, char *secondary)
runner_t runner = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
runinit(&runner);
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", "--verify", "spawning",
@@ -1181,10 +1152,7 @@ gsync_verify_config_options(dict_t *dict, char **op_errstr, char *volname)
gf_boolean_t op_match = _gf_true;
gf_boolean_t val_match = _gf_true;
struct gsync_config_opt_vals_ *conf_vals = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (dict_get_str(dict, "subop", &subop) != 0) {
gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_DICT_GET_FAILED,
@@ -1331,19 +1299,15 @@ _get_status_mst_slv(dict_t *dict, char *key, data_t *value, void *data)
char conf_path[PATH_MAX] = "";
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char sec_url[VOLINFO_SECONDARY_URL_MAX] = {0};
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
param = (glusterd_gsync_status_temp_t *)data;
GF_VALIDATE_OR_GOTO(this->name, param, out);
GF_VALIDATE_OR_GOTO(this->name, param->volinfo, out);
- if (this)
- priv = this->private;
+ priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
if (snprintf(sec_url, sizeof(sec_url), "%s", value->data) >=
@@ -1399,7 +1363,7 @@ out:
if (secondary_host)
GF_FREE(secondary_host);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d.", ret);
+ gf_msg_debug(this->name, 0, "Returning %d.", ret);
return ret;
}
@@ -1421,15 +1385,13 @@ _get_secondary_idx_secondary_voluuid(dict_t *dict, char *key, data_t *value,
void *data)
{
char *secondary_info = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct secondary_vol_config *sec_cfg = NULL;
+
int i = 0;
int ret = -1;
unsigned tmp_secnum = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
sec_cfg = data;
if (value)
@@ -1485,10 +1447,6 @@ glusterd_remove_secondary_in_info(glusterd_volinfo_t *volinfo, char *secondary,
int zero_secondary_entries = _gf_true;
int ret = 0;
char *secondarykey = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
@@ -1511,7 +1469,7 @@ glusterd_remove_secondary_in_info(glusterd_volinfo_t *volinfo, char *secondary,
goto out;
}
out:
- gf_msg_debug(this->name, 0, "returning %d", ret);
+ gf_msg_debug(THIS->name, 0, "returning %d", ret);
return ret;
}
@@ -1522,10 +1480,6 @@ glusterd_gsync_get_uuid(char *secondary, glusterd_volinfo_t *vol, uuid_t uuid)
char *secondarykey = NULL;
char *secondaryentry = NULL;
char *t = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(vol);
GF_ASSERT(secondary);
@@ -1552,7 +1506,7 @@ glusterd_gsync_get_uuid(char *secondary, glusterd_volinfo_t *vol, uuid_t uuid)
*t = ':';
out:
- gf_msg_debug(this->name, 0, "Returning %d", ret);
+ gf_msg_debug(THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -1564,7 +1518,7 @@ update_secondary_voluuid(dict_t *dict, char *key, data_t *value, void *data)
char *secondary_vol = NULL;
char *secondary_host = NULL;
char *errmsg = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
char sec_url[VOLINFO_SECONDARY_URL_MAX] = {0};
char secondary_voluuid[GF_UUID_BUF_SIZE] = {0};
@@ -1574,8 +1528,6 @@ update_secondary_voluuid(dict_t *dict, char *key, data_t *value, void *data)
int cnt = 0;
gf_boolean_t *voluuid_updated = NULL;
- this = THIS;
-
voluuid_updated = data;
secondary_info = value->data;
gf_msg_debug(this->name, 0, "secondary_info: %s!", secondary_info);
@@ -1683,11 +1635,9 @@ static int
glusterd_update_secondary_voluuid_secondaryinfo(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t voluuid_updated = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
ret = dict_foreach(volinfo->gsync_secondaries, update_secondary_voluuid,
@@ -1712,7 +1662,7 @@ glusterd_update_secondary_voluuid_secondaryinfo(glusterd_volinfo_t *volinfo)
ret = 0;
out:
- gf_msg_debug((this ? this->name : "glusterd"), 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1723,10 +1673,7 @@ glusterd_check_gsync_running_local(char *primary, char *secondary,
int ret = -1;
int ret_status = 0;
gf_boolean_t is_template_in_use = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(primary);
GF_ASSERT(secondary);
@@ -1764,14 +1711,11 @@ glusterd_store_secondary_in_info(glusterd_volinfo_t *volinfo, char *secondary,
};
int keylen;
char *t = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct secondary_vol_config secondary1 = {
{0},
};
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
GF_ASSERT(host_uuid);
@@ -1897,7 +1841,7 @@ glusterd_op_verify_gsync_start_options(glusterd_volinfo_t *volinfo,
gf_boolean_t is_template_in_use = _gf_false;
char msg[2048] = {0};
uuid_t uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct stat stbuf = {
0,
};
@@ -1906,14 +1850,11 @@ glusterd_op_verify_gsync_start_options(glusterd_volinfo_t *volinfo,
};
char *statedir = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
GF_ASSERT(op_errstr);
GF_ASSERT(conf_path);
- GF_ASSERT(this && this->private);
+ GF_ASSERT(this->private);
if (GLUSTERD_STATUS_STARTED != volinfo->status) {
snprintf(msg, sizeof(msg),
@@ -2040,10 +1981,7 @@ is_geo_rep_active(glusterd_volinfo_t *volinfo, char *secondary, char *conf_path,
char *primary = NULL;
char monitor_status[PATH_MAX] = "";
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
primary = volinfo->volname;
@@ -2122,7 +2060,7 @@ _get_secondary_status(dict_t *dict, char *key, data_t *value, void *data)
char conf_path[PATH_MAX] = "";
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
param = (gsync_status_param_t *)data;
@@ -2133,9 +2071,6 @@ _get_secondary_status(dict_t *dict, char *key, data_t *value, void *data)
goto out;
}
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
@@ -2213,10 +2148,7 @@ glusterd_check_geo_rep_running(gsync_status_param_t *param, char **op_errstr)
};
gf_boolean_t enabled = _gf_false;
int ret = 0;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(param);
GF_ASSERT(param->volinfo);
GF_ASSERT(op_errstr);
@@ -2227,7 +2159,7 @@ glusterd_check_geo_rep_running(gsync_status_param_t *param, char **op_errstr)
ret = dict_foreach(param->volinfo->gsync_secondaries,
_get_secondary_status, param);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0,
GD_MSG_SECONDARYINFO_FETCH_ERROR,
"_get_secondary_satus failed");
snprintf(msg, sizeof(msg),
@@ -2273,12 +2205,8 @@ glusterd_op_verify_gsync_running(glusterd_volinfo_t *volinfo, char *secondary,
0,
};
gf_boolean_t is_template_in_use = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
- GF_ASSERT(THIS && THIS->private);
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
GF_ASSERT(conf_path);
@@ -2355,13 +2283,9 @@ glusterd_verify_gsync_status_opts(dict_t *dict, char **op_errstr)
char *secondary_host = NULL;
char *secondary_vol = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -2413,10 +2337,8 @@ glusterd_op_gsync_args_get(dict_t *dict, char **op_errstr, char **primary,
char **secondary, char **host_uuid)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
@@ -2467,10 +2389,8 @@ glusterd_op_stage_sys_exec(dict_t *dict, char **op_errstr)
};
int ret = -1;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -2542,7 +2462,7 @@ glusterd_op_stage_copy_file(dict_t *dict, char **op_errstr)
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char workdir[PATH_MAX] = {
0,
};
@@ -2554,11 +2474,7 @@ glusterd_op_stage_copy_file(dict_t *dict, char **op_errstr)
};
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -2702,12 +2618,9 @@ glusterd_get_statefile_name(glusterd_volinfo_t *volinfo, char *secondary,
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(this->private);
GF_ASSERT(volinfo);
GF_ASSERT(conf_path);
@@ -2820,13 +2733,9 @@ glusterd_create_status_file(char *primary, char *secondary,
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -2880,11 +2789,9 @@ glusterd_verify_secondary(char *volname, char *secondary_url,
char *secondary_user = NULL;
char *secondary_ip = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *af = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volname);
@@ -2994,10 +2901,7 @@ glusterd_geo_rep_parse_secondary(char *secondary_url, char **hostname,
char *host = NULL;
char errmsg[PATH_MAX] = "";
char *saved_url = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(secondary_url);
GF_ASSERT(*secondary_url);
@@ -3068,14 +2972,11 @@ get_secondaryhost_from_voluuid(dict_t *dict, char *key, data_t *value,
char *secondary_info = NULL;
char *tmp = NULL;
char *secondary_host = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct secondary_vol_config *secondary_vol = NULL;
int i = 0;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
secondary_vol = data;
secondary_info = value->data;
@@ -3169,11 +3070,8 @@ glusterd_get_secondaryhost_from_voluuid(glusterd_volinfo_t *volinfo,
struct secondary_vol_config *secondary1)
{
int ret = -1;
- xlator_t *this = NULL;
- this = THIS;
-
- GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
+ GF_VALIDATE_OR_GOTO(THIS->name, volinfo, out);
ret = dict_foreach(volinfo->gsync_secondaries,
get_secondaryhost_from_voluuid, secondary1);
@@ -3209,7 +3107,7 @@ glusterd_op_stage_gsync_create(dict_t *dict, char **op_errstr)
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct secondary_vol_config secondary1 = {
{0},
};
@@ -3227,8 +3125,6 @@ glusterd_op_stage_gsync_create(dict_t *dict, char **op_errstr)
char *secondary_url_buf = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -3696,14 +3592,12 @@ glusterd_op_stage_gsync_set(dict_t *dict, char **op_errstr)
uuid_t uuid = {0};
char uuid_str[64] = {0};
char *host_uuid = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
struct stat stbuf = {
0,
};
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -4038,10 +3932,8 @@ gd_pause_or_resume_gsync(dict_t *dict, char *primary, char *secondary,
0,
};
char *statefile = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(primary);
GF_ASSERT(secondary);
@@ -4196,12 +4088,7 @@ stop_gsync(char *primary, char *secondary, char **msg, char *conf_path,
};
int i = 0;
gf_boolean_t is_template_in_use = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
-
- GF_ASSERT(this->private);
+ xlator_t *this = THIS;
pfd = gsyncd_getpidfile(primary, secondary, pidfile, conf_path,
&is_template_in_use);
@@ -4279,10 +4166,7 @@ glusterd_gsync_op_already_set(char *primary, char *secondary, char *conf_path,
int32_t op_val_cli = 0;
int32_t ret = -1;
gf_boolean_t is_bool = _gf_true;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
confd = dict_new();
if (!confd) {
@@ -4372,10 +4256,7 @@ glusterd_gsync_configure(glusterd_volinfo_t *volinfo, char *secondary,
gf_boolean_t restart_required = _gf_true;
char **resopt = NULL;
gf_boolean_t op_already_set = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(secondary);
GF_ASSERT(op_errstr);
@@ -4530,10 +4411,7 @@ glusterd_gsync_read_frm_status(char *path, char *buf, size_t blen)
{
int ret = 0;
int status_fd = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(path);
GF_ASSERT(buf);
@@ -4604,10 +4482,7 @@ glusterd_fetch_values_from_config(char *primary, char *secondary,
char **socketfile)
{
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = glusterd_gsync_get_config(primary, secondary, confpath, confd);
if (ret) {
@@ -4691,13 +4566,11 @@ glusterd_read_status_file(glusterd_volinfo_t *volinfo, char *secondary,
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
- GF_ASSERT(this->private);
+ priv = this->private;
+ GF_ASSERT(priv);
GF_ASSERT(volinfo);
GF_ASSERT(conf_path);
@@ -4710,8 +4583,6 @@ glusterd_read_status_file(glusterd_volinfo_t *volinfo, char *secondary,
return -1;
}
- priv = THIS->private;
-
len = snprintf(temp_conf_path, sizeof(temp_conf_path),
"%s/" GSYNC_CONF_TEMPLATE, priv->workdir);
if ((len < 0) || (len >= sizeof(temp_conf_path))) {
@@ -4934,19 +4805,14 @@ glusterd_check_restart_gsync_session(glusterd_volinfo_t *volinfo,
gf_boolean_t is_force)
{
int ret = 0;
- glusterd_conf_t *priv = NULL;
char *status_msg = NULL;
gf_boolean_t is_running = _gf_false;
char *op_errstr = NULL;
char *key = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
key = secondary;
@@ -4991,14 +4857,10 @@ static int32_t
glusterd_marker_changelog_create_volfile(glusterd_volinfo_t *volinfo)
{
int32_t ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
ret = glusterd_create_volfiles_and_notify_services(volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Unable to create volfile for setting of marker "
"while '" GEOREP " start'");
ret = -1;
@@ -5023,12 +4885,7 @@ glusterd_set_gsync_knob(glusterd_volinfo_t *volinfo, char *key, int *vc)
{
int ret = -1;
int conf_enabled = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
-
- GF_ASSERT(this->private);
+ xlator_t *this = THIS;
conf_enabled = glusterd_volinfo_get_boolean(volinfo, key);
if (conf_enabled == -1) {
@@ -5091,14 +4948,10 @@ glusterd_get_gsync_status_mst_slv(glusterd_volinfo_t *volinfo, char *secondary,
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
GF_ASSERT(secondary);
- GF_ASSERT(this->private);
ret = glusterd_gsync_get_uuid(secondary, volinfo, uuid);
if (ret) {
@@ -5164,10 +5017,7 @@ glusterd_get_gsync_status_all(dict_t *rsp_dict, char *node)
int32_t ret = 0;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
@@ -5199,10 +5049,7 @@ glusterd_get_gsync_status(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char my_hostname[256] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = gethostname(my_hostname, 256);
if (ret) {
@@ -5264,12 +5111,9 @@ glusterd_gsync_delete(glusterd_volinfo_t *volinfo, char *secondary,
char *gl_workdir = NULL;
char geo_rep_dir[PATH_MAX] = "";
char *conf_path = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t reset_sync_time = _gf_false;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(secondary);
GF_ASSERT(secondary_host);
GF_ASSERT(secondary_vol);
@@ -5277,8 +5121,7 @@ glusterd_gsync_delete(glusterd_volinfo_t *volinfo, char *secondary,
GF_ASSERT(dict);
GF_ASSERT(resp_dict);
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -5376,17 +5219,13 @@ glusterd_op_sys_exec(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
runner_t runner = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -5523,14 +5362,10 @@ glusterd_op_copy_file(dict_t *dict, char **op_errstr)
0,
};
gf_boolean_t free_contents = _gf_true;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
- if (THIS)
- priv = THIS->private;
+ priv = this->private;
if (priv == NULL) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_PRIV_NOT_FOUND,
"priv of glusterd not present");
@@ -5750,10 +5585,8 @@ glusterd_op_gsync_set(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
gf_boolean_t is_running = _gf_false;
char *conf_path = NULL;
char *key = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(dict);
@@ -5973,10 +5806,7 @@ glusterd_get_secondary_details_confpath(glusterd_volinfo_t *volinfo,
char confpath[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
char *secondary = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -6053,10 +5883,7 @@ glusterd_get_secondary_info(char *secondary, char **secondary_url,
char **linearr = NULL;
int32_t ret = -1;
char errmsg[PATH_MAX] = "";
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = glusterd_urltransform_single(secondary, "normalize", &linearr);
if ((ret == -1) || (linearr[0] == NULL)) {
@@ -6144,10 +5971,6 @@ glusterd_check_gsync_present(int *valid_state)
};
char *ptr = NULL;
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
runinit(&runner);
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", "--version", NULL);
@@ -6445,12 +6268,9 @@ glusterd_create_essential_dir_files(glusterd_volinfo_t *volinfo, dict_t *dict,
struct stat stbuf = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
ret = dict_get_str(dict, "conf_path", &conf_path);
@@ -6583,7 +6403,7 @@ glusterd_op_gsync_create(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
gf_boolean_t is_force = -1;
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char old_working_dir[PATH_MAX] = {0};
char new_working_dir[PATH_MAX] = {0};
char *secondary_voluuid = NULL;
@@ -6591,8 +6411,6 @@ glusterd_op_gsync_create(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
gf_boolean_t is_existing_session = _gf_false;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
GF_ASSERT(dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c
index a0bfea41f0..391c18cd4a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c
@@ -72,13 +72,10 @@ glusterd_gfproxydsvc_init(glusterd_volinfo_t *volinfo)
glusterd_svc_t *svc = NULL;
glusterd_conf_t *priv = NULL;
glusterd_conn_notify_t notify = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volfileserver = NULL;
int32_t len = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -126,11 +123,9 @@ glusterd_gfproxydsvc_init(glusterd_volinfo_t *volinfo)
}
ret = glusterd_proc_init(&(svc->proc), gfproxyd_svc_name, pidfile, logdir,
logfile, volfile, volfileid, volfileserver);
- if (ret)
- goto out;
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -138,20 +133,15 @@ static int
glusterd_gfproxydsvc_create_volfile(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
+ xlator_t *this = THIS;
ret = glusterd_generate_gfproxyd_volfile(volinfo);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create volfile");
- goto out;
}
-out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -161,10 +151,7 @@ glusterd_gfproxydsvc_manager(glusterd_svc_t *svc, void *data, int flags)
{
int ret = -1;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
+ xlator_t *this = THIS;
volinfo = data;
GF_VALIDATE_OR_GOTO(this->name, data, out);
@@ -272,7 +259,7 @@ glusterd_gfproxydsvc_start(glusterd_svc_t *svc, int flags)
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char valgrind_logfile[PATH_MAX] = {0};
int gfproxyd_port = 0;
char msg[1024] = {
@@ -285,9 +272,6 @@ glusterd_gfproxydsvc_start(glusterd_svc_t *svc, int flags)
char *localtime_logging = NULL;
int32_t len = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -381,8 +365,6 @@ glusterd_gfproxydsvc_restart()
glusterd_conf_t *conf = NULL;
glusterd_svc_t *svc = NULL;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -411,15 +393,11 @@ int
glusterd_gfproxydsvc_reconfigure(void *data)
{
int ret = -1;
- xlator_t *this = NULL;
gf_boolean_t identical = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
volinfo = data;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
if (!volinfo->gfproxyd.svc.inited)
goto manager;
@@ -460,7 +438,7 @@ glusterd_gfproxydsvc_reconfigure(void *data)
if (identical) {
ret = glusterd_gfproxydsvc_create_volfile(volinfo);
if (ret == 0) { /* Only if above PASSES */
- ret = glusterd_fetchspec_notify(this);
+ ret = glusterd_fetchspec_notify(THIS);
}
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 43b95ecbc6..2eaa3a3a55 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -297,12 +297,9 @@ _build_option_key(dict_t *d, char *k, data_t *v, void *tmp)
int keylen;
struct args_pack *pack = NULL;
int ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
pack = tmp;
@@ -376,7 +373,7 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes,
struct args_pack pack = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
char ta_brick[4096] = {
@@ -386,7 +383,6 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes,
GF_ASSERT(volinfo);
GF_ASSERT(volumes);
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -603,7 +599,7 @@ glusterd_op_txn_begin(rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
{
int32_t ret = -1;
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int32_t locked = 0;
char *tmp = NULL;
@@ -620,8 +616,6 @@ glusterd_op_txn_begin(rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
GF_ASSERT((op > GD_OP_NONE) && (op < GD_OP_MAX));
GF_ASSERT(NULL != ctx);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -768,10 +762,8 @@ __glusterd_handle_cluster_lock(rpcsvc_request_t *req)
};
glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -867,10 +859,7 @@ glusterd_req_ctx_create(rpcsvc_request_t *rpc_req, int op, uuid_t uuid,
};
glusterd_req_ctx_t *req_ctx = NULL;
dict_t *dict = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
gf_uuid_unparse(uuid, str);
gf_msg_debug(this->name, 0, "Received op from uuid %s", str);
@@ -917,7 +906,7 @@ __glusterd_handle_stage_op(rpcsvc_request_t *req)
gd1_mgmt_stage_op_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_op_info_t txn_op_info = {
{0},
@@ -927,8 +916,6 @@ __glusterd_handle_stage_op(rpcsvc_request_t *req)
};
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -1021,12 +1008,10 @@ __glusterd_handle_commit_op(rpcsvc_request_t *req)
gd1_mgmt_commit_op_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -1092,7 +1077,7 @@ __glusterd_handle_cli_probe(rpcsvc_request_t *req)
};
glusterd_peerinfo_t *peerinfo = NULL;
gf_boolean_t run_fsm = _gf_true;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *bind_name = NULL;
dict_t *dict = NULL;
char *hostname = NULL;
@@ -1100,7 +1085,6 @@ __glusterd_handle_cli_probe(rpcsvc_request_t *req)
int op_errno = 0;
GF_ASSERT(req);
- this = THIS;
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -1225,7 +1209,7 @@ __glusterd_handle_cli_deprobe(rpcsvc_request_t *req)
};
uuid_t uuid = {0};
int op_errno = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
dict_t *dict = NULL;
char *hostname = NULL;
@@ -1237,8 +1221,6 @@ __glusterd_handle_cli_deprobe(rpcsvc_request_t *req)
glusterd_snap_t *tmpsnap = NULL;
gf_boolean_t need_free = _gf_false;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -1451,10 +1433,9 @@ __glusterd_handle_cli_get_volume(rpcsvc_request_t *req)
}};
int32_t flags = 0;
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -1514,7 +1495,7 @@ __glusterd_handle_cli_uuid_reset(rpcsvc_request_t *req)
{
int ret = -1;
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
uuid_t uuid = {0};
gf_cli_rsp rsp = {
@@ -1529,7 +1510,6 @@ __glusterd_handle_cli_uuid_reset(rpcsvc_request_t *req)
GF_ASSERT(req);
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -1552,7 +1532,7 @@ __glusterd_handle_cli_uuid_reset(rpcsvc_request_t *req)
ret = dict_unserialize(cli_req.dict.dict_val, cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf(msg_str, sizeof(msg_str),
@@ -1633,7 +1613,7 @@ __glusterd_handle_cli_uuid_get(rpcsvc_request_t *req)
int ret = -1;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_cli_rsp rsp = {
0,
@@ -1650,7 +1630,6 @@ __glusterd_handle_cli_uuid_get(rpcsvc_request_t *req)
GF_ASSERT(req);
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -1842,10 +1821,7 @@ __glusterd_handle_ganesha_cmd(rpcsvc_request_t *req)
char err_str[2048] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(req);
@@ -1921,11 +1897,9 @@ __glusterd_handle_reset_volume(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
gf_msg(this->name, GF_LOG_INFO, 0, 0, "Received reset vol req");
@@ -2008,10 +1982,7 @@ __glusterd_handle_set_volume(rpcsvc_request_t *req)
char err_str[2048] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(req);
@@ -2126,11 +2097,9 @@ __glusterd_handle_sync_volume(rpcsvc_request_t *req)
char *volname = NULL;
gf1_cli_sync_volume flags = 0;
char *hostname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -2257,16 +2226,13 @@ __glusterd_handle_fsm_log(rpcsvc_request_t *req)
0,
};
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char msg[2048] = {0};
glusterd_peerinfo_t *peerinfo = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_VALIDATE_OR_GOTO("xlator", (this != NULL), out);
-
ret = xdr_to_generic(req->msg[0], &cli_req,
(xdrproc_t)xdr_gf1_cli_fsm_log_req);
if (ret < 0) {
@@ -2419,12 +2385,10 @@ __glusterd_handle_cluster_unlock(rpcsvc_request_t *req)
};
int32_t ret = -1;
glusterd_op_lock_ctx_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -2491,10 +2455,8 @@ glusterd_op_stage_send_resp(rpcsvc_request_t *req, int32_t op, int32_t status,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -2530,10 +2492,8 @@ glusterd_op_commit_send_resp(rpcsvc_request_t *req, int32_t op, int32_t status,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
glusterd_get_uuid(&rsp.uuid);
@@ -2719,7 +2679,7 @@ __glusterd_handle_friend_update(rpcsvc_request_t *req)
};
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gd1_mgmt_friend_update_rsp rsp = {
{0},
};
@@ -2739,8 +2699,6 @@ __glusterd_handle_friend_update(rpcsvc_request_t *req)
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -2909,7 +2867,7 @@ int
__glusterd_handle_probe_query(rpcsvc_request_t *req)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gd1_mgmt_probe_req probe_req = {
{0},
@@ -2926,9 +2884,6 @@ __glusterd_handle_probe_query(rpcsvc_request_t *req)
GF_ASSERT(req);
- this = THIS;
- GF_VALIDATE_OR_GOTO("xlator", (this != NULL), out);
-
ret = xdr_to_generic(req->msg[0], &probe_req,
(xdrproc_t)xdr_gd1_mgmt_probe_req);
if (ret < 0) {
@@ -3039,12 +2994,10 @@ __glusterd_handle_cli_profile_volume(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -3264,7 +3217,6 @@ __glusterd_handle_umount(rpcsvc_request_t *req)
glusterd_conf_t *priv = NULL;
GF_ASSERT(req);
- GF_ASSERT(this);
priv = this->private;
ret = xdr_to_generic(req->msg[0], &umnt_req,
@@ -3389,10 +3341,7 @@ glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options,
{
struct rpc_clnt *new_rpc = NULL;
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(options);
GF_VALIDATE_OR_GOTO(this->name, rpc, out);
@@ -3428,14 +3377,12 @@ int
glusterd_transport_inet_options_build(dict_t *dict, const char *hostname,
int port, char *af)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t interval = -1;
int32_t time = -1;
int32_t timeout = -1;
int ret = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(hostname);
@@ -3590,10 +3537,9 @@ glusterd_friend_add(const char *hoststr, int port,
glusterd_peerctx_args_t *args)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
GF_ASSERT(hoststr);
@@ -3651,10 +3597,9 @@ glusterd_friend_add_from_peerinfo(glusterd_peerinfo_t *friend,
glusterd_peerctx_args_t *args)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -3836,13 +3781,10 @@ glusterd_xfer_friend_remove_resp(rpcsvc_request_t *req, char *hostname,
{0},
};
int32_t ret = -1;
- xlator_t *this = NULL;
GF_ASSERT(hostname);
rsp.op_ret = 0;
- this = THIS;
- GF_ASSERT(this);
gf_uuid_copy(rsp.uuid, MY_UUID);
rsp.hostname = hostname;
@@ -3864,13 +3806,9 @@ glusterd_xfer_friend_add_resp(rpcsvc_request_t *req, char *myhostname,
{0},
};
int32_t ret = -1;
- xlator_t *this = NULL;
GF_ASSERT(myhostname);
- this = THIS;
- GF_ASSERT(this);
-
gf_uuid_copy(rsp.uuid, MY_UUID);
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
@@ -4016,7 +3954,6 @@ glusterd_xfer_cli_probe_resp(rpcsvc_request_t *req, int32_t op_ret,
xlator_t *this = THIS;
GF_ASSERT(req);
- GF_ASSERT(this);
(void)set_probe_error_str(op_ret, op_errno, op_errstr, errstr,
sizeof(errstr), hostname, port);
@@ -4181,7 +4118,6 @@ glusterd_list_friends(rpcsvc_request_t *req, dict_t *dict, int32_t flags)
int keylen;
xlator_t *this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4394,12 +4330,10 @@ __glusterd_handle_status_volume(rpcsvc_request_t *req)
char err_str[256] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -4537,11 +4471,9 @@ __glusterd_handle_cli_clearlocks_volume(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
ret = -1;
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
@@ -4618,10 +4550,8 @@ get_volinfo_from_brickid(char *brickid, glusterd_volinfo_t **volinfo)
char *brick = NULL;
char *brickid_dup = NULL;
uuid_t volid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickid);
brickid_dup = gf_strdup(brickid);
@@ -4660,7 +4590,7 @@ static int
__glusterd_handle_barrier(rpcsvc_request_t *req)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_cli_req cli_req = {{
0,
}};
@@ -4668,8 +4598,6 @@ __glusterd_handle_barrier(rpcsvc_request_t *req)
char *volname = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -4764,7 +4692,7 @@ glusterd_get_volume_opts(rpcsvc_request_t *req, dict_t *dict)
0,
};
int keylen;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
gf_cli_rsp rsp = {
@@ -4774,9 +4702,6 @@ glusterd_get_volume_opts(rpcsvc_request_t *req, dict_t *dict)
0,
};
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -5057,10 +4982,7 @@ __glusterd_handle_get_vol_opt(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(req);
@@ -5224,10 +5146,9 @@ glusterd_print_gsync_status_by_vol(FILE *fp, glusterd_volinfo_t *volinfo)
};
xlator_t *this = THIS;
- GF_ASSERT(this);
- GF_VALIDATE_OR_GOTO(THIS->name, volinfo, out);
- GF_VALIDATE_OR_GOTO(THIS->name, fp, out);
+ GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
+ GF_VALIDATE_OR_GOTO(this->name, fp, out);
gsync_rsp_dict = dict_new();
if (!gsync_rsp_dict) {
@@ -5311,7 +5232,7 @@ glusterd_print_client_details(FILE *fp, dict_t *dict,
glusterd_brickinfo_t *brickinfo, int brickcount)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int brick_index = -1;
int client_count = 0;
char key[64] = {
@@ -5330,9 +5251,6 @@ glusterd_print_client_details(FILE *fp, dict_t *dict,
};
gd1_mgmt_brick_op_req *brick_req = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
GF_VALIDATE_OR_GOTO(this->name, dict, out);
if (gf_uuid_compare(brickinfo->uuid, MY_UUID) ||
@@ -5510,7 +5428,7 @@ glusterd_get_state(rpcsvc_request_t *req, dict_t *dict)
glusterd_peer_hostname_t *peer_hostname_info = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *vol_all_opts = NULL;
struct statvfs brickstat = {0};
char *odir = NULL;
@@ -5548,8 +5466,6 @@ glusterd_get_state(rpcsvc_request_t *req, dict_t *dict)
char brick_status_str[STATUS_STRLEN] = {
0,
};
- this = THIS;
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
priv = THIS->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -5964,10 +5880,8 @@ __glusterd_handle_get_state(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
GF_VALIDATE_OR_GOTO(this->name, req, out);
gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DAEMON_STATE_REQ_RCVD,
@@ -6034,7 +5948,6 @@ get_brickinfo_from_brickid(char *brickid, glusterd_brickinfo_t **brickinfo)
int ret = -1;
xlator_t *this = THIS;
- GF_ASSERT(this);
brickid_dup = gf_strdup(brickid);
if (!brickid_dup) {
@@ -6088,7 +6001,7 @@ __glusterd_brick_rpc_notify(struct rpc_clnt *rpc, void *mydata,
glusterd_conf_t *conf = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t pid = -1;
glusterd_brickinfo_t *brickinfo_tmp = NULL;
glusterd_brick_proc_t *brick_proc = NULL;
@@ -6104,8 +6017,6 @@ __glusterd_brick_rpc_notify(struct rpc_clnt *rpc, void *mydata,
if (ret)
return 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -6319,7 +6230,7 @@ int
__glusterd_peer_rpc_notify(struct rpc_clnt *rpc, void *mydata,
rpc_clnt_event_t event, void *data)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = 0;
int32_t op_errno = ENOTCONN;
@@ -6335,7 +6246,6 @@ __glusterd_peer_rpc_notify(struct rpc_clnt *rpc, void *mydata,
if (!peerctx)
return 0;
- this = THIS;
conf = this->private;
switch (event) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 74422763a2..38ce54a3fe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -51,12 +51,10 @@ get_snap_volname_and_volinfo(const char *volpath, char **volname,
char *volname_token = NULL;
char *vol = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *tmp_str_token = NULL;
char *volfile_token = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volpath);
GF_ASSERT(volinfo);
@@ -189,7 +187,6 @@ glusterd_get_client_per_brick_volfile(glusterd_volinfo_t *volinfo,
glusterd_conf_t *priv = NULL;
int32_t ret = -1;
- GF_VALIDATE_OR_GOTO("glusterd", THIS, out);
priv = THIS->private;
GF_VALIDATE_OR_GOTO(THIS->name, priv, out);
@@ -222,13 +219,11 @@ build_volfile_path(char *volume_id, char *path, size_t path_len,
char path_prefix[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *volinfo = NULL;
glusterd_conf_t *priv = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volume_id);
@@ -533,11 +528,9 @@ glusterd_get_args_from_dict(gf_getspec_req *args, peer_info_t *peerinfo,
int client_max_op_version = 1;
int client_min_op_version = 1;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *name = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(args);
GF_ASSERT(peerinfo);
@@ -618,11 +611,9 @@ glusterd_create_missed_snap(glusterd_missed_snap_info *missed_snapinfo,
uuid_t snap_uuid = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *mnt_device = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(missed_snapinfo);
@@ -792,10 +783,8 @@ glusterd_take_missing_brick_snapshots(char *brick_name)
glusterd_snap_op_t *snap_opinfo = NULL;
int32_t ret = -1;
gf_boolean_t update_list = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(brick_name);
@@ -929,7 +918,7 @@ __server_getspec(rpcsvc_request_t *req)
};
char addrstr[RPCSVC_PEER_STRLEN] = {0};
peer_info_t *peerinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *dict = NULL;
glusterd_peerinfo_t *peer = NULL;
glusterd_conf_t *conf = NULL;
@@ -941,9 +930,6 @@ __server_getspec(rpcsvc_request_t *req)
};
int len = 0;
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_getspec_req);
if (ret < 0) {
@@ -1296,15 +1282,12 @@ gd_validate_mgmt_hndsk_req(rpcsvc_request_t *req, dict_t *dict)
0,
};
glusterd_peerinfo_t *peer = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *uuid_str = NULL;
uuid_t peer_uuid = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
if (!glusterd_have_peers() && !glusterd_have_volumes())
return _gf_true;
@@ -1367,7 +1350,7 @@ int
__glusterd_mgmt_hndsk_versions(rpcsvc_request_t *req)
{
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = -1;
int op_errno = EINVAL;
@@ -1381,7 +1364,6 @@ __glusterd_mgmt_hndsk_versions(rpcsvc_request_t *req)
};
dict_t *args_dict = NULL;
- this = THIS;
conf = this->private;
ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_mgmt_hndsk_req);
@@ -1470,7 +1452,7 @@ int
__glusterd_mgmt_hndsk_versions_ack(rpcsvc_request_t *req)
{
dict_t *clnt_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = -1;
int op_errno = EINVAL;
@@ -1484,7 +1466,6 @@ __glusterd_mgmt_hndsk_versions_ack(rpcsvc_request_t *req)
0,
};
- this = THIS;
conf = this->private;
ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_mgmt_hndsk_req);
@@ -1565,7 +1546,6 @@ __server_get_volume_info(rpcsvc_request_t *req)
int32_t flags = 0;
xlator_t *this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &vol_info_req,
(xdrproc_t)xdr_gf_get_volume_info_req);
@@ -2014,8 +1994,8 @@ gd_validate_peer_op_version(xlator_t *this, glusterd_peerinfo_t *peerinfo,
ret = 0;
out:
if (peerinfo)
- gf_msg_debug((this ? this->name : "glusterd"), 0, "Peer %s %s",
- peerinfo->hostname, ((ret < 0) ? "rejected" : "accepted"));
+ gf_msg_debug(this->name, 0, "Peer %s %s", peerinfo->hostname,
+ ((ret < 0) ? "rejected" : "accepted"));
return ret;
}
@@ -2027,7 +2007,7 @@ __glusterd_mgmt_hndsk_version_ack_cbk(struct rpc_req *req, struct iovec *iov,
gf_mgmt_hndsk_rsp rsp = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
call_frame_t *frame = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_peerctx_t *peerctx = NULL;
@@ -2035,7 +2015,6 @@ __glusterd_mgmt_hndsk_version_ack_cbk(struct rpc_req *req, struct iovec *iov,
0,
};
- this = THIS;
frame = myframe;
peerctx = frame->local;
@@ -2132,7 +2111,7 @@ __glusterd_mgmt_hndsk_version_cbk(struct rpc_req *req, struct iovec *iov,
gf_mgmt_hndsk_req arg = {{
0,
}};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
call_frame_t *frame = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_peerctx_t *peerctx = NULL;
@@ -2143,7 +2122,6 @@ __glusterd_mgmt_hndsk_version_cbk(struct rpc_req *req, struct iovec *iov,
0,
};
- this = THIS;
conf = this->private;
frame = myframe;
peerctx = frame->local;
@@ -2409,7 +2387,7 @@ __glusterd_peer_dump_version_cbk(struct rpc_req *req, struct iovec *iov,
gf_dump_rsp rsp = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_prog_detail *trav = NULL;
gf_prog_detail *next = NULL;
call_frame_t *frame = NULL;
@@ -2420,7 +2398,6 @@ __glusterd_peer_dump_version_cbk(struct rpc_req *req, struct iovec *iov,
0,
};
- this = THIS;
conf = this->private;
frame = myframe;
peerctx = frame->local;
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 61c0f1c946..c1a92e2d56 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -87,9 +87,7 @@ glusterd_hooks_create_hooks_directory(char *basedir)
glusterd_conf_t *priv = NULL;
int32_t len = 0;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
snprintf(path, sizeof(path), "%s/hooks", basedir);
@@ -180,10 +178,8 @@ glusterd_hooks_add_custom_args(dict_t *dict, runner_t *runner)
{
char *hooks_args = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
GF_VALIDATE_OR_GOTO(this->name, runner, out);
@@ -213,9 +209,7 @@ glusterd_hooks_set_volume_args(dict_t *dict, runner_t *runner)
char *key = NULL;
char *value = NULL;
char *inet_family = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_int32(dict, "count", &count);
if (ret) {
@@ -350,7 +344,7 @@ int
glusterd_hooks_run_hooks(char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
glusterd_commit_hook_type_t type)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
runner_t runner = {
0,
};
@@ -368,8 +362,6 @@ glusterd_hooks_run_hooks(char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
int line_count = 0;
int ret = -1;
- this = THIS;
-
ret = dict_get_str(op_ctx, "volname", &volname);
if (ret) {
gf_msg(this->name, GF_LOG_CRITICAL, errno, GD_MSG_DICT_GET_FAILED,
@@ -496,9 +488,7 @@ glusterd_hooks_stub_init(glusterd_hooks_stub_t **stub, char *scriptdir,
int ret = -1;
glusterd_hooks_stub_t *hooks_stub = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(stub);
if (!stub)
goto out;
@@ -591,9 +581,7 @@ glusterd_hooks_priv_init(glusterd_hooks_private_t **new)
int ret = -1;
glusterd_hooks_private_t *hooks_priv = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!new) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 11523f2854..0e300e85ff 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -58,12 +58,9 @@ int32_t
glusterd_mgmt_v3_lock_init()
{
int32_t ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
priv->mgmt_v3_lock = dict_new();
@@ -80,12 +77,9 @@ out:
void
glusterd_mgmt_v3_lock_fini()
{
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
if (priv->mgmt_v3_lock)
@@ -98,12 +92,9 @@ int32_t
glusterd_mgmt_v3_lock_timer_init()
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -121,12 +112,9 @@ out:
void
glusterd_mgmt_v3_lock_timer_fini()
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -142,10 +130,8 @@ glusterd_get_mgmt_v3_lock_owner(char *key, uuid_t *uuid)
int32_t ret = -1;
glusterd_mgmt_v3_lock_obj *lock_obj = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -177,10 +163,8 @@ glusterd_release_multiple_locks_per_entity(dict_t *dict, uuid_t uuid,
int32_t i = -1;
int32_t op_ret = 0;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(type);
@@ -232,10 +216,8 @@ glusterd_acquire_multiple_locks_per_entity(dict_t *dict, uuid_t uuid,
int32_t i = -1;
int32_t ret = -1;
int32_t locked_count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(type);
@@ -296,10 +278,8 @@ glusterd_mgmt_v3_unlock_entity(dict_t *dict, uuid_t uuid, char *type,
int32_t count = -1;
int32_t ret = -1;
gf_boolean_t hold_locks = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(type);
@@ -366,10 +346,8 @@ glusterd_mgmt_v3_lock_entity(dict_t *dict, uuid_t uuid, uint32_t *op_errno,
int32_t count = -1;
int32_t ret = -1;
gf_boolean_t hold_locks = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(type);
@@ -430,10 +408,7 @@ glusterd_multiple_mgmt_v3_unlock(dict_t *dict, uuid_t uuid)
int32_t i = -1;
int32_t ret = -1;
int32_t op_ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!dict) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_EMPTY, "dict is null.");
@@ -466,10 +441,7 @@ glusterd_multiple_mgmt_v3_lock(dict_t *dict, uuid_t uuid, uint32_t *op_errno)
int32_t i = -1;
int32_t ret = -1;
int32_t locked_count = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!dict) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_EMPTY, "dict is null.");
@@ -524,16 +496,13 @@ glusterd_mgmt_v3_lock(const char *name, uuid_t uuid, uint32_t *op_errno,
glusterd_conf_t *priv = NULL;
gf_boolean_t is_valid = _gf_true;
uuid_t owner = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *bt = NULL;
struct timespec delay = {0};
char *key_dup = NULL;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -669,7 +638,7 @@ out:
void
gd_mgmt_v3_unlock_timer_cbk(void *data)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
char *key = NULL;
@@ -681,9 +650,6 @@ gd_mgmt_v3_unlock_timer_cbk(void *data)
xlator_t *mgmt_lock_timer_xl = NULL;
gf_timer_t *timer = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -746,14 +712,11 @@ glusterd_mgmt_v3_unlock(const char *name, uuid_t uuid, char *type)
glusterd_volinfo_t *volinfo = NULL;
glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
uuid_t owner = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL;
gf_timer_t *timer = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
index 34abf35cb0..3f210e0a26 100644
--- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
@@ -33,11 +33,9 @@ __glusterd_handle_log_rotate(rpcsvc_request_t *req)
char msg[64] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
@@ -170,7 +168,6 @@ glusterd_op_log_rotate(dict_t *dict)
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
char *volname = NULL;
char *brick = NULL;
char logfile[PATH_MAX] = {
@@ -185,9 +182,7 @@ glusterd_op_log_rotate(dict_t *dict)
int valid_brick = 0;
glusterd_brickinfo_t *tmpbrkinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
ret = dict_get_str(dict, "volname", &volname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index 1069688a89..4020f38b89 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -35,10 +35,7 @@ glusterd_mgmt_v3_lock_send_resp(rpcsvc_request_t *req, int32_t status,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -50,7 +47,7 @@ glusterd_mgmt_v3_lock_send_resp(rpcsvc_request_t *req, int32_t status,
ret = glusterd_submit_reply(req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
- gf_msg_debug(this->name, 0, "Responded to mgmt_v3 lock, ret: %d", ret);
+ gf_msg_debug(THIS->name, 0, "Responded to mgmt_v3 lock, ret: %d", ret);
return ret;
}
@@ -61,11 +58,9 @@ glusterd_synctasked_mgmt_v3_lock(rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(ctx);
GF_ASSERT(ctx->dict);
@@ -88,13 +83,11 @@ glusterd_op_state_machine_mgmt_v3_lock(rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_op_info_t txn_op_info = {
{0},
};
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
glusterd_txn_opinfo_init(&txn_op_info, NULL, &lock_req->op, ctx->dict, req);
@@ -127,16 +120,14 @@ glusterd_handle_mgmt_v3_lock_fn(rpcsvc_request_t *req)
};
int32_t ret = -1;
glusterd_op_lock_ctx_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_synctasked = _gf_false;
gf_boolean_t free_ctx = _gf_false;
glusterd_conf_t *conf = NULL;
uint32_t timeout = 0;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &lock_req,
@@ -248,10 +239,8 @@ glusterd_mgmt_v3_pre_validate_send_resp(rpcsvc_request_t *req, int32_t op,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -287,14 +276,12 @@ glusterd_handle_pre_validate_fn(rpcsvc_request_t *req)
gd1_mgmt_v3_pre_val_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &op_req,
@@ -377,10 +364,8 @@ glusterd_mgmt_v3_brick_op_send_resp(rpcsvc_request_t *req, int32_t op,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -415,13 +400,11 @@ glusterd_handle_brick_op_fn(rpcsvc_request_t *req)
gd1_mgmt_v3_brick_op_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &op_req,
@@ -504,10 +487,8 @@ glusterd_mgmt_v3_commit_send_resp(rpcsvc_request_t *req, int32_t op,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -543,14 +524,12 @@ glusterd_handle_commit_fn(rpcsvc_request_t *req)
gd1_mgmt_v3_commit_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &op_req,
@@ -634,10 +613,8 @@ glusterd_mgmt_v3_post_commit_send_resp(rpcsvc_request_t *req, int32_t op,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -673,14 +650,12 @@ glusterd_handle_post_commit_fn(rpcsvc_request_t *req)
gd1_mgmt_v3_post_commit_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &op_req,
@@ -764,10 +739,8 @@ glusterd_mgmt_v3_post_validate_send_resp(rpcsvc_request_t *req, int32_t op,
{0},
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -802,13 +775,11 @@ glusterd_handle_post_validate_fn(rpcsvc_request_t *req)
gd1_mgmt_v3_post_val_req op_req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &op_req,
@@ -890,10 +861,7 @@ glusterd_mgmt_v3_unlock_send_resp(rpcsvc_request_t *req, int32_t status)
{0},
};
int ret = -1;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
rsp.op_ret = status;
@@ -905,7 +873,7 @@ glusterd_mgmt_v3_unlock_send_resp(rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply(req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
- gf_msg_debug(this->name, 0, "Responded to mgmt_v3 unlock, ret: %d", ret);
+ gf_msg_debug(THIS->name, 0, "Responded to mgmt_v3 unlock, ret: %d", ret);
return ret;
}
@@ -916,10 +884,8 @@ glusterd_syctasked_mgmt_v3_unlock(rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(ctx);
@@ -942,10 +908,8 @@ glusterd_op_state_machine_mgmt_v3_unlock(rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = glusterd_op_sm_inject_event(GD_OP_EVENT_UNLOCK, &lock_req->txn_id,
@@ -969,12 +933,10 @@ glusterd_handle_mgmt_v3_unlock_fn(rpcsvc_request_t *req)
};
int32_t ret = -1;
glusterd_op_lock_ctx_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_synctasked = _gf_false;
gf_boolean_t free_ctx = _gf_false;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &lock_req,
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index bca7221062..6dc65f6ddf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -37,14 +37,11 @@ gd_mgmt_v3_collate_errors(struct syncargs *args, int op_ret, int op_errno,
char *peer_str = NULL;
char err_str[PATH_MAX] = "Please check log file for details.";
char op_err[PATH_MAX] = "";
- xlator_t *this = NULL;
int is_operrstr_blk = 0;
char *err_string = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(args);
GF_ASSERT(uuid);
@@ -118,7 +115,7 @@ gd_mgmt_v3_collate_errors(struct syncargs *args, int op_ret, int op_errno,
} else
snprintf(err_str, sizeof(err_str), "%s", op_err);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_MGMTV3_OP_FAIL, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_MGMTV3_OP_FAIL, "%s",
op_err);
args->errstr = gf_strdup(err_str);
}
@@ -133,10 +130,8 @@ gd_mgmt_v3_pre_validate_fn(glusterd_op_t op, dict_t *dict, char **op_errstr,
dict_t *rsp_dict, uint32_t *op_errno)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
@@ -250,10 +245,8 @@ gd_mgmt_v3_brick_op_fn(glusterd_op_t op, dict_t *dict, char **op_errstr,
dict_t *rsp_dict)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
@@ -296,10 +289,8 @@ gd_mgmt_v3_commit_fn(glusterd_op_t op, dict_t *dict, char **op_errstr,
uint32_t *op_errno, dict_t *rsp_dict)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -414,10 +405,8 @@ gd_mgmt_v3_post_commit_fn(glusterd_op_t op, dict_t *dict, char **op_errstr,
uint32_t *op_errno, dict_t *rsp_dict)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -455,12 +444,10 @@ gd_mgmt_v3_post_validate_fn(glusterd_op_t op, int32_t op_ret, dict_t *dict,
char **op_errstr, dict_t *rsp_dict)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
@@ -566,11 +553,8 @@ gd_mgmt_v3_lock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
int32_t op_ret = -1;
int32_t op_errno = -1;
- xlator_t *this = NULL;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -593,7 +577,7 @@ gd_mgmt_v3_lock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, iov, out, op_errno, EINVAL);
+ GF_VALIDATE_OR_GOTO_WITH_ERROR(THIS->name, iov, out, op_errno, EINVAL);
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
if (ret < 0)
@@ -636,11 +620,9 @@ gd_mgmt_v3_lock(glusterd_op_t op, dict_t *op_ctx, glusterd_peerinfo_t *peerinfo,
{0},
};
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -684,12 +666,10 @@ glusterd_mgmt_v3_initiate_lockdown(glusterd_op_t op, dict_t *dict,
int32_t peer_cnt = 0;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
uint32_t timeout = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -784,10 +764,8 @@ int
glusterd_pre_validate_aggr_rsp_dict(glusterd_op_t op, dict_t *aggr, dict_t *rsp)
{
int32_t ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(aggr);
GF_ASSERT(rsp);
@@ -861,11 +839,9 @@ gd_mgmt_v3_pre_validate_cbk_fn(struct rpc_req *req, struct iovec *iov,
int32_t op_ret = -1;
int32_t op_errno = -1;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -958,11 +934,9 @@ gd_mgmt_v3_pre_validate_req(glusterd_op_t op, dict_t *op_ctx,
gd1_mgmt_v3_pre_val_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -1006,11 +980,9 @@ glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict,
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1133,11 +1105,9 @@ glusterd_mgmt_v3_build_payload(dict_t **req, char **op_errstr, dict_t *dict,
{
int32_t ret = -1;
dict_t *req_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volname = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(op_errstr);
GF_ASSERT(dict);
@@ -1221,11 +1191,9 @@ gd_mgmt_v3_brick_op_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
int32_t op_ret = -1;
int32_t op_errno = -1;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -1324,13 +1292,11 @@ gd_mgmt_v3_brick_op_req(glusterd_op_t op, dict_t *op_ctx,
gd1_mgmt_v3_brick_op_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = {
0,
};
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -1373,11 +1339,9 @@ glusterd_mgmt_v3_brick_op(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1492,11 +1456,9 @@ gd_mgmt_v3_commit_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
int32_t op_ret = -1;
int32_t op_errno = -1;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -1589,11 +1551,9 @@ gd_mgmt_v3_commit_req(glusterd_op_t op, dict_t *op_ctx,
gd1_mgmt_v3_commit_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -1637,11 +1597,9 @@ glusterd_mgmt_v3_commit(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1778,11 +1736,9 @@ gd_mgmt_v3_post_commit_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
int32_t op_ret = -1;
int32_t op_errno = -1;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -1876,11 +1832,9 @@ gd_mgmt_v3_post_commit_req(glusterd_op_t op, dict_t *op_ctx,
gd1_mgmt_v3_post_commit_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -1924,11 +1878,9 @@ glusterd_mgmt_v3_post_commit(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -2045,11 +1997,8 @@ gd_mgmt_v3_post_validate_cbk_fn(struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int32_t op_ret = -1;
int32_t op_errno = -1;
- xlator_t *this = NULL;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -2064,7 +2013,7 @@ gd_mgmt_v3_post_validate_cbk_fn(struct rpc_req *req, struct iovec *iov,
goto out;
}
- GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, iov, out, op_errno, EINVAL);
+ GF_VALIDATE_OR_GOTO_WITH_ERROR(THIS->name, iov, out, op_errno, EINVAL);
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_post_val_rsp);
if (ret < 0)
@@ -2112,11 +2061,9 @@ gd_mgmt_v3_post_validate_req(glusterd_op_t op, int32_t op_ret, dict_t *op_ctx,
gd1_mgmt_v3_post_val_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -2161,11 +2108,9 @@ glusterd_mgmt_v3_post_validate(glusterd_op_t op, int32_t op_ret, dict_t *dict,
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -2272,11 +2217,8 @@ gd_mgmt_v3_unlock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
int32_t op_ret = -1;
int32_t op_errno = -1;
- xlator_t *this = NULL;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -2291,7 +2233,7 @@ gd_mgmt_v3_unlock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, iov, out, op_errno, EINVAL);
+ GF_VALIDATE_OR_GOTO_WITH_ERROR(THIS->name, iov, out, op_errno, EINVAL);
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
if (ret < 0)
@@ -2334,11 +2276,9 @@ gd_mgmt_v3_unlock(glusterd_op_t op, dict_t *op_ctx,
gd1_mgmt_v3_unlock_req req = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_ctx);
GF_ASSERT(peerinfo);
GF_ASSERT(args);
@@ -2380,13 +2320,11 @@ glusterd_mgmt_v3_release_peer_locks(glusterd_op_t op, dict_t *dict,
int32_t ret = -1;
int32_t peer_cnt = 0;
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -2461,14 +2399,12 @@ glusterd_mgmt_v3_initiate_all_phases_with_brickop_phase(rpcsvc_request_t *req,
dict_t *tmp_dict = NULL;
glusterd_conf_t *conf = NULL;
char *op_errstr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_acquired = _gf_false;
uuid_t *originator_uuid = NULL;
uint32_t txn_generation = 0;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
conf = this->private;
@@ -2627,14 +2563,12 @@ glusterd_mgmt_v3_initiate_all_phases(rpcsvc_request_t *req, glusterd_op_t op,
dict_t *tmp_dict = NULL;
glusterd_conf_t *conf = NULL;
char *op_errstr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_acquired = _gf_false;
uuid_t *originator_uuid = NULL;
uint32_t txn_generation = 0;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
conf = this->private;
@@ -2788,13 +2722,10 @@ int32_t
glusterd_set_barrier_value(dict_t *dict, char *option)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *vol = NULL;
char *volname = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(dict);
GF_ASSERT(option);
@@ -2859,7 +2790,7 @@ glusterd_mgmt_v3_initiate_snap_phases(rpcsvc_request_t *req, glusterd_op_t op,
dict_t *tmp_dict = NULL;
glusterd_conf_t *conf = NULL;
char *op_errstr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_acquired = _gf_false;
uuid_t *originator_uuid = NULL;
gf_boolean_t success = _gf_false;
@@ -2867,8 +2798,6 @@ glusterd_mgmt_v3_initiate_snap_phases(rpcsvc_request_t *req, glusterd_op_t op,
uint32_t txn_generation = 0;
uint32_t op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
conf = this->private;
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index 4908dbbc21..97d9479c0e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -145,21 +145,18 @@ int
glusterd_nfssvc_reconfigure()
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t identical = _gf_false;
gf_boolean_t vol_started = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
/* not an error, or a (very) soft error at best */
if (sys_access(XLATORDIR "/nfs/server.so", R_OK) != 0) {
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_GNFS_XLATOR_NOT_INSTALLED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_GNFS_XLATOR_NOT_INSTALLED,
"nfs/server.so xlator is not installed");
ret = 0;
goto out;
@@ -222,7 +219,7 @@ glusterd_nfssvc_reconfigure()
ret = priv->nfs_svc.manager(&(priv->nfs_svc), NULL, PROC_START_NO_WAIT);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 9833004efc..b6a73c9f8e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -97,11 +97,9 @@ int32_t
glusterd_txn_opinfo_dict_init()
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -122,12 +120,9 @@ out:
void
glusterd_txn_opinfo_dict_fini()
{
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
if (priv->glusterd_txn_opinfo)
@@ -171,10 +166,8 @@ glusterd_generate_txn_id(dict_t *dict, uuid_t **txn_id)
{
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(dict);
@@ -213,10 +206,8 @@ glusterd_get_txn_opinfo(uuid_t *txn_id, glusterd_op_info_t *opinfo)
int32_t ret = -1;
glusterd_txn_opinfo_obj *opinfo_obj = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -250,10 +241,8 @@ glusterd_set_txn_opinfo(uuid_t *txn_id, glusterd_op_info_t *opinfo)
int32_t ret = -1;
glusterd_txn_opinfo_obj *opinfo_obj = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -309,10 +298,8 @@ glusterd_clear_txn_opinfo(uuid_t *txn_id)
{0},
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -530,12 +517,9 @@ glusterd_brick_op_build_payload(glusterd_op_t op,
0,
};
gf_xl_afr_op_t heal_op = GF_SHD_OP_INVALID;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(op < GD_OP_MAX);
GF_ASSERT(op > GD_OP_NONE);
GF_ASSERT(req);
@@ -686,9 +670,7 @@ glusterd_node_op_build_payload(glusterd_op_t op, gd1_mgmt_brick_op_req **req,
GF_ASSERT(op < GD_OP_MAX);
GF_ASSERT(op > GD_OP_NONE);
GF_ASSERT(req);
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
switch (op) {
case GD_OP_PROFILE_VOLUME:
@@ -811,14 +793,11 @@ glusterd_validate_shared_storage(char *value, char *errstr)
int32_t count = -1;
char *op = NULL;
char hook_script[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int32_t len = 0;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -913,13 +892,10 @@ static int
glusterd_validate_localtime_logging(char *value, char *errstr)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int already_enabled = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
GF_VALIDATE_OR_GOTO(this->name, value, out);
@@ -956,12 +932,9 @@ static int
glusterd_validate_daemon_log_level(char *value, char *errstr)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -1016,7 +989,7 @@ glusterd_op_stage_set_volume(dict_t *dict, char **op_errstr)
gf_boolean_t key_matched = _gf_false; /* if a key was processed or not*/
glusterd_volinfo_t *voliter = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t new_op_version = GD_OP_VERSION_MIN;
uint32_t local_new_op_version = GD_OP_VERSION_MIN;
uint32_t local_new_client_op_version = GD_OP_VERSION_MIN;
@@ -1029,8 +1002,6 @@ glusterd_op_stage_set_volume(dict_t *dict, char **op_errstr)
struct volopt_map_entry *vmep = NULL;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1566,12 +1537,9 @@ glusterd_op_stage_reset_volume(dict_t *dict, char **op_errstr)
char *key = NULL;
char *key_fixed = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -1685,9 +1653,7 @@ glusterd_op_stage_sync_volume(dict_t *dict, char **op_errstr)
0,
};
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(dict, "hostname", SLEN("hostname"), &hostname);
if (ret) {
@@ -1761,7 +1727,7 @@ glusterd_op_stage_status_volume(dict_t *dict, char **op_errstr)
};
char *volname = NULL;
char *brick = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
@@ -1772,8 +1738,6 @@ glusterd_op_stage_status_volume(dict_t *dict, char **op_errstr)
gf_boolean_t shd_enabled = _gf_false;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -2103,11 +2067,9 @@ glusterd_options_reset(glusterd_volinfo_t *volinfo, char *key,
int ret = 0;
data_t *value = NULL;
char *key_fixed = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_svc_t *svc = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volinfo->dict);
GF_ASSERT(key);
@@ -2290,9 +2252,8 @@ glusterd_op_reset_volume(dict_t *dict, char **op_rspstr)
char *key_fixed = NULL;
int32_t is_force = 0;
gf_boolean_t quorum_action = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -2431,13 +2392,10 @@ static int
glusterd_update_volumes_dict(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char *address_family_str = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -2491,11 +2449,9 @@ glusterd_set_brick_mx_opts(dict_t *dict, char *key, char *value,
char **op_errstr)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
GF_VALIDATE_OR_GOTO(this->name, key, out);
GF_VALIDATE_OR_GOTO(this->name, value, out);
@@ -2793,11 +2749,9 @@ glusterd_set_shared_storage(dict_t *dict, char *key, char *value,
char errstr[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
GF_VALIDATE_OR_GOTO(this->name, key, out);
GF_VALIDATE_OR_GOTO(this->name, value, out);
@@ -2873,7 +2827,7 @@ glusterd_op_set_volume(dict_t *dict, char **errstr)
int ret = 0;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int count = 1;
char *key = NULL;
@@ -2892,9 +2846,6 @@ glusterd_op_set_volume(dict_t *dict, char **errstr)
gf_boolean_t quorum_action = _gf_false;
glusterd_svc_t *svc = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -3169,10 +3120,8 @@ glusterd_op_sync_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int vol_count = 0;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -3377,15 +3326,12 @@ _add_remove_bricks_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo,
};
int keylen;
char *brick = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(volinfo);
GF_ASSERT(prefix);
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_int32n(volinfo->rebal.dict, "count", SLEN("count"), &count);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -3443,14 +3389,11 @@ _add_task_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo, int op, int index)
int keylen;
char *uuid_str = NULL;
int status = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(volinfo);
- this = THIS;
- GF_ASSERT(this);
-
switch (op) {
case GD_OP_REMOVE_BRICK:
snprintf(key, sizeof(key), "task%d", index);
@@ -3514,10 +3457,7 @@ glusterd_aggregate_task_status(dict_t *rsp_dict, glusterd_volinfo_t *volinfo)
{
int ret = -1;
int tasks = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!gf_uuid_is_null(volinfo->rebal.rebalance_id)) {
ret = _add_task_to_dict(rsp_dict, volinfo, volinfo->rebal.op, tasks);
@@ -3550,7 +3490,7 @@ glusterd_op_status_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
uint32_t cmd = 0;
char *volname = NULL;
char *brick = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_conf_t *priv = NULL;
@@ -3562,8 +3502,6 @@ glusterd_op_status_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
gf_boolean_t origin_glusterd = _gf_false;
int snapd_enabled, bitrot_enabled, volume_quota_enabled;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -3844,12 +3782,11 @@ glusterd_op_ac_send_lock(glusterd_op_sm_event_t *event, void *ctx)
int ret = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
uint32_t pending_count = 0;
dict_t *dict = NULL;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -3947,12 +3884,11 @@ glusterd_op_ac_send_unlock(glusterd_op_sm_event_t *event, void *ctx)
int ret = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
uint32_t pending_count = 0;
dict_t *dict = NULL;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -4081,7 +4017,7 @@ glusterd_op_ac_lock(glusterd_op_sm_event_t *event, void *ctx)
char *volname = NULL;
char *globalname = NULL;
glusterd_op_lock_ctx_t *lock_ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t op_errno = 0;
glusterd_conf_t *conf = NULL;
uint32_t timeout = 0;
@@ -4089,8 +4025,6 @@ glusterd_op_ac_lock(glusterd_op_sm_event_t *event, void *ctx)
GF_ASSERT(event);
GF_ASSERT(ctx);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -4152,12 +4086,11 @@ glusterd_op_ac_unlock(glusterd_op_sm_event_t *event, void *ctx)
char *globalname = NULL;
glusterd_op_lock_ctx_t *lock_ctx = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(event);
GF_ASSERT(ctx);
- this = THIS;
priv = this->private;
lock_ctx = (glusterd_op_lock_ctx_t *)ctx;
@@ -4259,10 +4192,7 @@ glusterd_dict_set_volid(dict_t *dict, char *volname, char **op_errstr)
char msg[1024] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!dict || !volname) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
@@ -4336,14 +4266,11 @@ glusterd_op_build_payload(dict_t **req, char **op_errstr, dict_t *op_ctx)
glusterd_op_t op = GD_OP_NONE;
char *volname = NULL;
uint32_t status_cmd = GF_CLI_STATUS_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t do_common = _gf_false;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
-
req_dict = dict_new();
if (!req_dict)
goto out;
@@ -4528,7 +4455,7 @@ glusterd_op_ac_send_stage_op(glusterd_op_sm_event_t *event, void *ctx)
int ret1 = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
@@ -4536,8 +4463,6 @@ glusterd_op_ac_send_stage_op(glusterd_op_sm_event_t *event, void *ctx)
glusterd_op_t op = GD_OP_NONE;
uint32_t pending_count = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4672,10 +4597,7 @@ glusterd_op_volume_dict_uuid_to_hostname(dict_t *dict, const char *key_fmt,
0,
};
char *hostname = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(key_fmt);
@@ -4890,7 +4812,7 @@ glusterd_op_modify_op_ctx(glusterd_op_t op, void *ctx)
int other_count = 0;
int count = 0;
uint32_t cmd = GF_CLI_STATUS_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
@@ -4901,8 +4823,6 @@ glusterd_op_modify_op_ctx(glusterd_op_t op, void *ctx)
};
int keylen;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
if (ctx)
@@ -5168,15 +5088,13 @@ glusterd_op_ac_send_commit_op(glusterd_op_sm_event_t *event, void *ctx)
int ret1 = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *dict = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
char *op_errstr = NULL;
glusterd_op_t op = GD_OP_NONE;
uint32_t pending_count = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -5258,7 +5176,7 @@ out:
ret1 = glusterd_set_txn_opinfo(&event->txn_id, &opinfo);
if (ret1)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -5373,10 +5291,7 @@ glusterd_op_ac_brick_op_failed(glusterd_op_sm_event_t *event, void *ctx)
int ret = 0;
glusterd_op_brick_rsp_ctx_t *ev_ctx = NULL;
gf_boolean_t free_errstr = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(event);
GF_ASSERT(ctx);
@@ -5430,10 +5345,8 @@ glusterd_op_ac_rcvd_commit_op_acc(glusterd_op_sm_event_t *event, void *ctx)
int ret = 0;
gf_boolean_t commit_ack_inject = _gf_true;
glusterd_op_t op = GD_OP_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
op = glusterd_op_get_op();
GF_ASSERT(event);
@@ -5442,7 +5355,7 @@ glusterd_op_ac_rcvd_commit_op_acc(glusterd_op_sm_event_t *event, void *ctx)
ret = glusterd_set_txn_opinfo(&event->txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -5541,10 +5454,7 @@ glusterd_op_txn_complete(uuid_t *txn_id)
void *ctx = NULL;
char *op_errstr = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -5638,16 +5548,13 @@ glusterd_op_ac_stage_op(glusterd_op_sm_event_t *event, void *ctx)
dict_t *rsp_dict = NULL;
char *op_errstr = NULL;
dict_t *dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_op_info_t txn_op_info = {
{0},
};
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -5769,15 +5676,13 @@ glusterd_op_ac_commit_op(glusterd_op_sm_event_t *event, void *ctx)
char *op_errstr = NULL;
dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_op_info_t txn_op_info = {
{0},
};
gf_boolean_t need_cleanup = _gf_true;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(ctx);
req_ctx = ctx;
@@ -6317,7 +6222,7 @@ glusterd_bricks_select_profile_volume(dict_t *dict, char **op_errstr,
};
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t stats_op = GF_CLI_STATS_NONE;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_pending_node_t *pending_node = NULL;
@@ -6325,8 +6230,6 @@ glusterd_bricks_select_profile_volume(dict_t *dict, char **op_errstr,
int32_t pid = -1;
char pidfile[PATH_MAX] = {0};
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -6731,19 +6634,13 @@ glusterd_bricks_select_snap(dict_t *dict, char **op_errstr,
struct cds_list_head *selected)
{
int ret = -1;
- glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_pending_node_t *pending_node = NULL;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
int brick_index = -1;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
-
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -6778,7 +6675,7 @@ glusterd_bricks_select_snap(dict_t *dict, char **op_errstr,
ret = 0;
out:
- gf_msg_debug(THIS->name, 0, "Returning ret %d", ret);
+ gf_msg_debug(this->name, 0, "Returning ret %d", ret);
return ret;
}
@@ -6797,16 +6694,14 @@ fill_shd_status_for_local_bricks(dict_t *dict, glusterd_volinfo_t *volinfo,
0,
};
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int cmd_replica_index = -1;
- this = THIS;
-
if (type == PER_HEAL_XL) {
cmd_replica_index = get_replica_index_for_per_replica_cmd(volinfo,
req_dict);
if (cmd_replica_index == -1) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_REPLICA_INDEX_GET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_REPLICA_INDEX_GET_FAIL,
"Could not find the "
"replica index for per replica type command");
ret = -1;
@@ -6861,11 +6756,9 @@ glusterd_shd_select_brick_xlator(dict_t *dict, gf_xl_afr_op_t heal_op,
{
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_svc_t *svc = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
svc = &(volinfo->shd.svc);
@@ -6945,7 +6838,7 @@ glusterd_bricks_select_heal_volume(dict_t *dict, char **op_errstr,
char *volname = NULL;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char msg[2048] = {
0,
};
@@ -6954,8 +6847,6 @@ glusterd_bricks_select_heal_volume(dict_t *dict, char **op_errstr,
int hxlator_count = 0;
int index = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7014,7 +6905,7 @@ glusterd_bricks_select_heal_volume(dict_t *dict, char **op_errstr,
}
out:
- gf_msg_debug(THIS->name, 0, "Returning ret %d", ret);
+ gf_msg_debug(this->name, 0, "Returning ret %d", ret);
return ret;
}
@@ -7025,15 +6916,11 @@ glusterd_bricks_select_rebalance_volume(dict_t *dict, char **op_errstr,
int ret = -1;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
char msg[2048] = {
0,
};
glusterd_pending_node_t *pending_node = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -7077,14 +6964,12 @@ glusterd_bricks_select_status_volume(dict_t *dict, char **op_errstr,
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_pending_node_t *pending_node = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_svc_t *svc = NULL;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7291,7 +7176,7 @@ glusterd_bricks_select_status_volume(dict_t *dict, char **op_errstr,
gf_gld_mt_pending_node_t);
if (!pending_node) {
ret = -1;
- gf_msg(THIS->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
"Unable to allocate memory");
goto out;
}
@@ -7315,14 +7200,12 @@ glusterd_bricks_select_scrub(dict_t *dict, char **op_errstr,
char msg[2048] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_pending_node_t *pending_node = NULL;
- this = THIS;
priv = this->private;
- GF_ASSERT(this);
GF_ASSERT(priv);
GF_ASSERT(dict);
@@ -7426,13 +7309,12 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
int ret = 0;
rpc_clnt_procedure_t *proc = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_op_t op = GD_OP_NONE;
glusterd_req_ctx_t *req_ctx = NULL;
char *op_errstr = NULL;
gf_boolean_t free_req_ctx = _gf_false;
- this = THIS;
priv = this->private;
if (ctx) {
@@ -7489,10 +7371,8 @@ glusterd_op_ac_rcvd_brick_op_acc(glusterd_op_sm_event_t *event, void *ctx)
dict_t *op_ctx = NULL;
glusterd_req_ctx_t *req_ctx = NULL;
void *pending_entry = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, event, out);
GF_VALIDATE_OR_GOTO(this->name, ctx, out);
ev_ctx = ctx;
@@ -7536,7 +7416,7 @@ out:
if (ev_ctx && ev_ctx->rsp_dict)
dict_unref(ev_ctx->rsp_dict);
GF_FREE(ev_ctx);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -8015,12 +7895,10 @@ glusterd_op_sm()
glusterd_op_sm_ac_fn handler = NULL;
glusterd_op_sm_t *state = NULL;
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_op_info_t txn_op_info;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index 14778defb5..1606287d71 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -100,7 +100,6 @@ gd_peerinfo_find_from_hostname(const char *hoststr)
glusterd_peerinfo_t *found = NULL;
glusterd_peer_hostname_t *tmphost = NULL;
- GF_ASSERT(this != NULL);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, (priv != NULL), out);
@@ -148,7 +147,6 @@ gd_peerinfo_find_from_addrinfo(const struct addrinfo *addr)
struct addrinfo *paddr = NULL;
struct addrinfo *tmp = NULL;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -240,14 +238,7 @@ glusterd_hostname_to_uuid(char *hostname, uuid_t uuid)
GF_ASSERT(uuid);
glusterd_peerinfo_t *peerinfo = NULL;
- glusterd_conf_t *priv = NULL;
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
peerinfo = glusterd_peerinfo_find_by_hostname(hostname);
if (peerinfo) {
@@ -262,7 +253,7 @@ glusterd_hostname_to_uuid(char *hostname, uuid_t uuid)
}
}
- gf_msg_debug(this->name, 0, "returning %d", ret);
+ gf_msg_debug(THIS->name, 0, "returning %d", ret);
return ret;
}
@@ -279,8 +270,6 @@ glusterd_peerinfo_find_by_uuid(uuid_t uuid)
xlator_t *this = THIS;
glusterd_friend_sm_state_t state;
- GF_ASSERT(this);
-
if (gf_uuid_is_null(uuid))
return NULL;
@@ -318,8 +307,6 @@ glusterd_peerinfo_find(uuid_t uuid, const char *hostname)
glusterd_peerinfo_t *peerinfo = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
-
if (uuid) {
peerinfo = glusterd_peerinfo_find_by_uuid(uuid);
@@ -358,11 +345,9 @@ glusterd_peerinfo_new(glusterd_friend_sm_state_t state, uuid_t *uuid,
{
glusterd_peerinfo_t *new_peer = NULL;
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -493,13 +478,10 @@ gf_boolean_t
glusterd_are_all_peers_up()
{
glusterd_peerinfo_t *peerinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_boolean_t peers_up = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -566,14 +548,12 @@ glusterd_peer_hostname_new(const char *hostname,
GF_ASSERT(hostname);
GF_ASSERT(name);
- xlator_t *this = THIS;
- GF_ASSERT(this);
peer_hostname = GF_CALLOC(1, sizeof(*peer_hostname),
gf_gld_mt_peer_hostname_t);
if (!peer_hostname) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_NO_MEMORY, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_NO_MEMORY, NULL);
goto out;
}
@@ -659,7 +639,7 @@ gd_add_friend_to_dict(glusterd_peerinfo_t *friend, dict_t *dict,
const char *prefix)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[100] = {
0,
@@ -667,9 +647,6 @@ gd_add_friend_to_dict(glusterd_peerinfo_t *friend, dict_t *dict,
glusterd_peer_hostname_t *address = NULL;
int count = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", (this != NULL), out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -725,7 +702,7 @@ gd_add_friend_to_dict(glusterd_peerinfo_t *friend, dict_t *dict,
"Failed to set key %s in dict", key);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -738,7 +715,7 @@ gd_update_peerinfo_from_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
const char *prefix)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[100] = {
0,
@@ -747,9 +724,6 @@ gd_update_peerinfo_from_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
int count = 0;
int i = 0;
- this = THIS;
- GF_ASSERT(this != NULL);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -826,7 +800,7 @@ glusterd_peerinfo_t *
gd_peerinfo_from_dict(dict_t *dict, const char *prefix)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_peerinfo_t *new_peer = NULL;
char key[64] = {
@@ -834,9 +808,6 @@ gd_peerinfo_from_dict(dict_t *dict, const char *prefix)
};
char *uuid_str = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", (this != NULL), out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -879,7 +850,7 @@ gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
const char *prefix)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[64] = {
0,
@@ -887,9 +858,6 @@ gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
glusterd_peer_hostname_t *addr = NULL;
int count = 0;
- this = THIS;
- GF_ASSERT(this != NULL);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -933,7 +901,6 @@ gd_add_peer_detail_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *friends,
char *peer_uuid_str = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peerinfo);
GF_ASSERT(friends);
@@ -1008,8 +975,6 @@ glusterd_peerinfo_find_by_generation(uint32_t generation)
xlator_t *this = THIS;
glusterd_friend_sm_state_t state;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -1039,13 +1004,10 @@ int
glusterd_get_peers_count()
{
int count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_peerinfo_t *peer = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 16ac628ab8..b7399569b8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -434,7 +434,6 @@ __gluster_pmap_portbybrick(rpcsvc_request_t *req)
int port = 0;
int ret = -1;
xlator_t *this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &args,
(xdrproc_t)xdr_pmap_port_by_brick_req);
@@ -478,14 +477,12 @@ __gluster_pmap_brickbyport(rpcsvc_request_t *req)
0,
};
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &args,
(xdrproc_t)xdr_pmap_brick_by_port_req);
if (ret < 0) {
req->rpc_err = GARBAGE_ARGS;
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
goto fail;
}
@@ -519,13 +516,11 @@ __gluster_pmap_signin(rpcsvc_request_t *req)
};
int ret = -1;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_pmap_signin_req);
if (ret < 0) {
req->rpc_err = GARBAGE_ARGS;
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
goto fail;
}
@@ -561,7 +556,7 @@ __gluster_pmap_signout(rpcsvc_request_t *req)
0,
};
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
@@ -570,8 +565,6 @@ __gluster_pmap_signout(rpcsvc_request_t *req)
0,
};
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, fail);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, fail);
@@ -582,14 +575,14 @@ __gluster_pmap_signout(rpcsvc_request_t *req)
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
goto fail;
}
- rsp.op_ret = pmap_registry_remove(THIS, args.port, args.brick,
+ rsp.op_ret = pmap_registry_remove(this, args.port, args.brick,
GF_PMAP_PORT_BRICKSERVER, req->trans,
_gf_false);
ret = glusterd_get_brickinfo(THIS, args.brick, args.port, &brickinfo);
if (args.rdma_port) {
snprintf(brick_path, PATH_MAX, "%s.rdma", args.brick);
- rsp.op_ret = pmap_registry_remove(THIS, args.rdma_port, brick_path,
+ rsp.op_ret = pmap_registry_remove(this, args.rdma_port, brick_path,
GF_PMAP_PORT_BRICKSERVER, req->trans,
_gf_false);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
index a05c90d7b1..3236b0b9a7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
@@ -71,12 +71,9 @@ glusterd_proc_stop(glusterd_proc_t *proc, int sig, int flags)
int32_t ret = -1;
pid_t pid = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index 8370c174ce..9164ef0142 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -104,13 +104,10 @@ const char *gd_quota_op_list[GF_QUOTA_OPTION_TYPE_MAX + 1] = {
gf_boolean_t
glusterd_is_quota_supported(int32_t type, char **op_errstr)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_boolean_t supported = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -172,12 +169,10 @@ __glusterd_handle_quota(rpcsvc_request_t *req)
char msg[2048] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -304,13 +299,12 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
char *volfileserver = NULL;
FILE *pidfp = NULL;
int32_t len = 0;
-
- GF_VALIDATE_OR_GOTO("glusterd", THIS, out);
+ xlator_t *this = THIS;
GLUSTERD_GET_TMP_PATH(mountdir, "/");
ret = sys_mkdir(mountdir, 0755);
if (ret && errno != EEXIST) {
- gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_MOUNT_REQ_FAIL,
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_MOUNT_REQ_FAIL,
"failed to create temporary "
"directory %s",
mountdir);
@@ -320,7 +314,7 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
strcat(mountdir, "mntXXXXXX");
if (mkdtemp(mountdir) == NULL) {
- gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_MOUNT_REQ_FAIL,
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_MOUNT_REQ_FAIL,
"failed to create a temporary "
"mount directory: %s",
mountdir);
@@ -336,7 +330,7 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
goto out;
}
- if (dict_get_strn(THIS->options, "transport.socket.bind-address",
+ if (dict_get_strn(this->options, "transport.socket.bind-address",
SLEN("transport.socket.bind-address"),
&volfileserver) != 0)
volfileserver = "localhost";
@@ -373,7 +367,7 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
runner_end(&runner);
if ((pid = fork()) < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_FORK_FAIL,
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_FORK_FAIL,
"fork from parent failed");
gf_umount_lazy("glusterd", mountdir, 1);
ret = -1;
@@ -392,7 +386,7 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
ret = chdir(mountdir);
if (ret == -1) {
- gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_DIR_OP_FAILED,
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DIR_OP_FAILED,
"chdir %s failed", mountdir);
gf_umount_lazy("glusterd", mountdir, 1);
exit(EXIT_FAILURE);
@@ -502,8 +496,6 @@ glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv,
0,
};
- GF_VALIDATE_OR_GOTO("glusterd", THIS, out);
-
ret = glusterd_generate_client_per_brick_volfile(volinfo);
if (ret) {
gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_OP_FAILED,
@@ -561,19 +553,12 @@ glusterd_quota_get_default_soft_limit(glusterd_volinfo_t *volinfo,
dict_t *rsp_dict)
{
int32_t ret = 0;
- xlator_t *this = NULL;
- glusterd_conf_t *conf = NULL;
char *default_limit = NULL;
char *val = NULL;
if (rsp_dict == NULL)
return -1;
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
- GF_ASSERT(conf);
-
ret = glusterd_volinfo_get(volinfo, "features.default-soft-limit",
&default_limit);
if (default_limit)
@@ -583,7 +568,7 @@ glusterd_quota_get_default_soft_limit(glusterd_volinfo_t *volinfo,
ret = dict_set_dynstr_sizen(rsp_dict, "default-soft-limit", val);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Failed to set default "
"soft-limit into dict");
goto out;
@@ -599,10 +584,7 @@ glusterd_inode_quota_enable(glusterd_volinfo_t *volinfo, char **op_errstr,
gf_boolean_t *crawl)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, crawl, out);
@@ -659,10 +641,7 @@ glusterd_quota_enable(glusterd_volinfo_t *volinfo, char **op_errstr,
gf_boolean_t *crawl)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, crawl, out);
@@ -729,7 +708,7 @@ glusterd_quota_disable(glusterd_volinfo_t *volinfo, char **op_errstr,
int32_t ret = -1;
int i = 0;
char *value = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char *quota_options[] = {"features.soft-timeout",
"features.hard-timeout",
@@ -739,8 +718,6 @@ glusterd_quota_disable(glusterd_volinfo_t *volinfo, char **op_errstr,
"features.quota-timeout",
NULL};
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -799,11 +776,9 @@ glusterd_set_quota_limit(char *volname, char *path, char *hard_limit,
char *soft_limit, char *key, char **op_errstr)
{
int ret = -1;
- xlator_t *this = NULL;
char abspath[PATH_MAX] = {
0,
};
- glusterd_conf_t *priv = NULL;
quota_limits_t existing_limit = {
0,
};
@@ -813,11 +788,6 @@ glusterd_set_quota_limit(char *volname, char *path, char *hard_limit,
double soft_limit_double = 0;
int64_t local_hl = 0;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
-
GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(abspath, volname, path);
ret = gf_lstat_dir(abspath, NULL);
if (ret) {
@@ -952,12 +922,9 @@ glusterd_find_gfid_match(uuid_t gfid, char gfid_type, unsigned char *buf,
0,
};
char type = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -1002,12 +969,10 @@ glusterd_copy_to_tmp_file(int src_fd, int dst_fd, int qconf_line_sz)
{
int ret = 0;
ssize_t bytes_read = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
unsigned char *buf = 0;
int buf_sz = qconf_line_sz * 1000;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(buf_sz > 0);
buf = GF_CALLOC(buf_sz, 1, gf_common_mt_char);
@@ -1049,12 +1014,9 @@ glusterd_store_quota_conf_upgrade(glusterd_volinfo_t *volinfo)
unsigned char gfid[17] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char type = 0;
- this = THIS;
- GF_ASSERT(this);
-
fd = gf_store_mkstemp(volinfo->quota_conf_shandle);
if (fd < 0) {
ret = -1;
@@ -1134,7 +1096,7 @@ glusterd_store_quota_config(glusterd_volinfo_t *volinfo, char *path,
uuid_t gfid = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t found = _gf_false;
gf_boolean_t modified = _gf_false;
gf_boolean_t is_file_empty = _gf_false;
@@ -1146,8 +1108,6 @@ glusterd_store_quota_config(glusterd_volinfo_t *volinfo, char *path,
unsigned char *buf = 0;
int buf_sz = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1384,10 +1344,7 @@ glusterd_quota_limit_usage(glusterd_volinfo_t *volinfo, dict_t *dict,
char *hard_limit = NULL;
char *soft_limit = NULL;
char *gfid_str = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, dict, out);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
@@ -1473,16 +1430,9 @@ glusterd_remove_quota_limit(char *volname, char *path, char **op_errstr,
int type)
{
int ret = -1;
- xlator_t *this = NULL;
char abspath[PATH_MAX] = {
0,
};
- glusterd_conf_t *priv = NULL;
-
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(abspath, volname, path);
ret = gf_lstat_dir(abspath, NULL);
@@ -1528,10 +1478,7 @@ glusterd_quota_remove_limits(glusterd_volinfo_t *volinfo, dict_t *dict,
int32_t ret = -1;
char *path = NULL;
char *gfid_str = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, dict, out);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
@@ -1589,12 +1536,9 @@ glusterd_set_quota_option(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
int ret = 0;
char *value = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *option = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = glusterd_check_if_quota_trans_enabled(volinfo);
if (ret == -1) {
gf_asprintf(op_errstr,
@@ -1626,13 +1570,9 @@ static int
glusterd_quotad_op(int opcode)
{
int ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
switch (opcode) {
@@ -1662,13 +1602,11 @@ glusterd_op_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int type = -1;
gf_boolean_t start_crawl = _gf_false;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1848,7 +1786,7 @@ glusterd_get_gfid_from_brick(dict_t *dict, glusterd_volinfo_t *volinfo,
char backend_path[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
char key[64] = {
@@ -1858,8 +1796,6 @@ glusterd_get_gfid_from_brick(dict_t *dict, glusterd_volinfo_t *volinfo,
char *gfid_str = NULL;
uuid_t gfid;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1951,7 +1887,6 @@ _glusterd_validate_quota_opts(dict_t *dict, int type, char **errstr)
char *value = NULL;
GF_ASSERT(dict);
- GF_ASSERT(this);
ret = xlator_volopt_dynload("features/quota", &quota_xl, &opt_list);
if (ret)
@@ -2094,15 +2029,13 @@ glusterd_op_stage_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int ret = 0;
char *volname = NULL;
int type = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
char *hard_limit_str = NULL;
int64_t hard_limit = 0;
gf_boolean_t get_gfid = _gf_false;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
index f26d832a06..bd49a9911f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
@@ -154,13 +154,10 @@ int
glusterd_quotadsvc_reconfigure()
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t identical = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -212,6 +209,6 @@ manager:
PROC_START_NO_WAIT);
out:
- gf_msg_debug(this ? this->name : "Quotad", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 458bf168ed..d5551ab933 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -60,10 +60,7 @@ glusterd_defrag_start_validate(glusterd_volinfo_t *volinfo, char *op_errstr,
size_t len, glusterd_op_t op)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
/* Check only if operation is not remove-brick */
if ((GD_OP_REMOVE_BRICK != op) && !gd_is_remove_brick_committed(volinfo)) {
@@ -102,13 +99,9 @@ __glusterd_defrag_notify(struct rpc_clnt *rpc, void *mydata,
int ret = 0;
char pidfile[PATH_MAX];
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int pid = -1;
- this = THIS;
- if (!this)
- return 0;
-
priv = this->private;
if (!priv)
return 0;
@@ -196,7 +189,7 @@ glusterd_handle_defrag_start(glusterd_volinfo_t *volinfo, char *op_errstr,
size_t len, int cmd, defrag_cbk_fn_t cbk,
glusterd_op_t op)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
glusterd_defrag_info_t *defrag = NULL;
runner_t runner = {
@@ -225,9 +218,6 @@ glusterd_handle_defrag_start(glusterd_volinfo_t *volinfo, char *op_errstr,
char *volfileserver = NULL;
char *localtime_logging = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO("glusterd", priv, out);
@@ -389,13 +379,6 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo)
};
int ret = -1;
glusterd_defrag_info_t *defrag = volinfo->rebal.defrag;
- glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
// rebalance process is not started
if (!defrag)
@@ -403,7 +386,7 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo)
options = dict_new();
if (!options) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
}
@@ -498,11 +481,9 @@ __glusterd_handle_defrag_volume(rpcsvc_request_t *req)
char msg[2048] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -592,17 +573,13 @@ static int
glusterd_brick_validation(dict_t *dict, char *key, data_t *value, void *data)
{
int32_t ret = -1;
- xlator_t *this = NULL;
glusterd_volinfo_t *volinfo = data;
glusterd_brickinfo_t *brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = glusterd_volume_brickinfo_get_by_brick(value->data, volinfo,
&brickinfo, _gf_false);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_BRICK_NOT_FOUND,
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_BRICK_NOT_FOUND,
"Incorrect brick %s for "
"volume %s",
value->data, volinfo->volname);
@@ -610,7 +587,7 @@ glusterd_brick_validation(dict_t *dict, char *key, data_t *value, void *data)
}
if (!brickinfo->decommissioned) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_BRICK_NOT_FOUND,
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_BRICK_NOT_FOUND,
"Incorrect brick %s for "
"volume %s",
value->data, volinfo->volname);
@@ -630,10 +607,7 @@ glusterd_set_rebalance_id_in_rsp_dict(dict_t *req_dict, dict_t *rsp_dict)
glusterd_volinfo_t *volinfo = NULL;
char msg[2048] = {0};
char *task_id_str = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(rsp_dict);
GF_ASSERT(req_dict);
@@ -722,10 +696,7 @@ glusterd_mgmt_v3_op_stage_rebalance(dict_t *dict, char **op_errstr)
char msg[2048] = {0};
glusterd_volinfo_t *volinfo = NULL;
char *task_id_str = NULL;
- xlator_t *this = 0;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
@@ -869,13 +840,10 @@ glusterd_mgmt_v3_op_rebalance(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
glusterd_brickinfo_t *tmp = NULL;
gf_boolean_t volfile_update = _gf_false;
char *task_id_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t commit_hash;
int32_t is_force = 0;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
gf_msg_debug(this->name, 0, "volname not given");
@@ -1032,10 +1000,7 @@ glusterd_op_stage_rebalance(dict_t *dict, char **op_errstr)
glusterd_volinfo_t *volinfo = NULL;
char *task_id_str = NULL;
dict_t *op_ctx = NULL;
- xlator_t *this = 0;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
@@ -1188,13 +1153,10 @@ glusterd_op_rebalance(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
gf_boolean_t volfile_update = _gf_false;
char *task_id_str = NULL;
dict_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t commit_hash;
int32_t is_force = 0;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
gf_msg_debug(this->name, 0, "volname not given");
@@ -1376,10 +1338,8 @@ glusterd_defrag_event_notify_handle(dict_t *dict)
char *volname = NULL;
char *volname_ptr = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 04aa0162c4..509224a127 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -47,12 +47,10 @@ __glusterd_handle_replace_brick(rpcsvc_request_t *req)
char msg[256] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
@@ -186,13 +184,10 @@ glusterd_op_stage_replace_brick(dict_t *dict, char **op_errstr,
glusterd_brickinfo_t *dst_brickinfo = NULL;
glusterd_conf_t *priv = NULL;
char pidfile[PATH_MAX] = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_force = _gf_false;
char *dup_dstbrick = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -362,14 +357,12 @@ glusterd_op_perform_replace_brick(glusterd_volinfo_t *volinfo, char *old_brick,
glusterd_brickinfo_t *old_brickinfo = NULL;
glusterd_brickinfo_t *new_brickinfo = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
struct statvfs brickstat = {
0,
};
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(volinfo);
@@ -467,16 +460,13 @@ glusterd_op_replace_brick(dict_t *dict, dict_t *rsp_dict)
char *replace_op = NULL;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char *src_brick = NULL;
char *dst_brick = NULL;
glusterd_brickinfo_t *src_brickinfo = NULL;
glusterd_brickinfo_t *dst_brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -604,12 +594,10 @@ glusterd_mgmt_v3_initiate_replace_brick_cmd_phases(rpcsvc_request_t *req,
dict_t *req_dict = NULL;
dict_t *tmp_dict = NULL;
uuid_t *originator_uuid = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_boolean_t is_acquired = _gf_false;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
conf = this->private;
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index 407bd8f838..67af4ad4bc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -44,7 +44,7 @@ glusterd_reset_brick_prevalidate(dict_t *dict, char **op_errstr,
glusterd_brickinfo_t *dst_brickinfo = NULL;
glusterd_conf_t *priv = NULL;
char pidfile[PATH_MAX] = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_force = _gf_false;
int32_t ignore_partition = 0;
pid_t pid = -1;
@@ -53,9 +53,6 @@ glusterd_reset_brick_prevalidate(dict_t *dict, char **op_errstr,
};
char *dup_dstbrick = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -227,16 +224,13 @@ glusterd_op_reset_brick(dict_t *dict, dict_t *rsp_dict)
char *op = NULL;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char *src_brick = NULL;
char *dst_brick = NULL;
glusterd_brickinfo_t *src_brickinfo = NULL;
glusterd_brickinfo_t *dst_brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 88662e3bba..c4deef86ff 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -53,10 +53,8 @@ glusterd_op_send_cli_response(glusterd_op_t op, int32_t op_ret,
gf_cli_rsp rsp = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -229,15 +227,13 @@ __glusterd_probe_cbk(struct rpc_req *req, struct iovec *iov, int count,
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_friend_sm_event_t *event = NULL;
glusterd_probe_ctx_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
if (-1 == req->rpc_status) {
goto out;
}
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -359,7 +355,7 @@ __glusterd_probe_cbk(struct rpc_req *req, struct iovec *iov, int count,
goto unlock;
} else if (strncasecmp(rsp.hostname, peerinfo->hostname, 1024)) {
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_HOST_PRESENT_ALREADY,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_HOST_PRESENT_ALREADY,
"Host: %s with uuid: %s "
"already present in cluster with alias hostname: %s",
rsp.hostname, uuid_utoa(rsp.uuid), peerinfo->hostname);
@@ -663,10 +659,9 @@ __glusterd_friend_update_cbk(struct rpc_req *req, struct iovec *iov, int count,
gd1_mgmt_friend_update_rsp rsp = {
{0},
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(req);
- this = THIS;
if (-1 == req->rpc_status) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_RPC_FAILURE, "RPC Error");
@@ -709,13 +704,11 @@ __glusterd_cluster_lock_cbk(struct rpc_req *req, struct iovec *iov, int count,
int ret = -1;
int32_t op_ret = -1;
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_conf_t *priv = NULL;
char *err_str = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -783,7 +776,7 @@ out:
ret = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -824,13 +817,11 @@ glusterd_mgmt_v3_lock_peers_cbk_fn(struct rpc_req *req, struct iovec *iov,
int ret = -1;
int32_t op_ret = -1;
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
call_frame_t *frame = NULL;
uuid_t *txn_id = NULL;
char *err_str = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
frame = myframe;
@@ -899,7 +890,7 @@ out:
ret = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -932,13 +923,11 @@ glusterd_mgmt_v3_unlock_peers_cbk_fn(struct rpc_req *req, struct iovec *iov,
int ret = -1;
int32_t op_ret = -1;
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
call_frame_t *frame = NULL;
uuid_t *txn_id = NULL;
char *err_str = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
frame = myframe;
@@ -1007,7 +996,7 @@ out:
ret = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -1041,13 +1030,11 @@ __glusterd_cluster_unlock_cbk(struct rpc_req *req, struct iovec *iov, int count,
int ret = -1;
int32_t op_ret = -1;
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_conf_t *priv = NULL;
char *err_str = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -1108,7 +1095,7 @@ out:
ret = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -1144,13 +1131,11 @@ __glusterd_stage_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
char *peer_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
call_frame_t *frame = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
priv = this->private;
GF_ASSERT(priv);
@@ -1241,7 +1226,7 @@ out:
ret = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -1286,7 +1271,7 @@ __glusterd_commit_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
char *peer_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
uuid_t *txn_id = NULL;
glusterd_op_info_t txn_op_info = {
@@ -1294,8 +1279,6 @@ __glusterd_commit_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
};
call_frame_t *frame = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
priv = this->private;
GF_ASSERT(priv);
@@ -1461,8 +1444,8 @@ glusterd_rpc_probe(call_frame_t *frame, xlator_t *this, void *data)
glusterd_conf_t *priv = NULL;
dict_t *dict = NULL;
- if (!frame || !this || !data) {
- gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ if (!frame || !data) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
ret = -1;
goto out;
}
@@ -1501,7 +1484,7 @@ glusterd_rpc_probe(call_frame_t *frame, xlator_t *this, void *data)
out:
GF_FREE(req.hostname);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1517,8 +1500,8 @@ glusterd_rpc_friend_add(call_frame_t *frame, xlator_t *this, void *data)
glusterd_friend_sm_event_t *event = NULL;
dict_t *peer_data = NULL;
- if (!frame || !this || !data) {
- gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ if (!frame || !data) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
ret = -1;
goto out;
}
@@ -1614,7 +1597,7 @@ out:
if (peer_data)
dict_unref(peer_data);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1629,7 +1612,7 @@ glusterd_rpc_friend_remove(call_frame_t *frame, xlator_t *this, void *data)
glusterd_conf_t *priv = NULL;
glusterd_friend_sm_event_t *event = NULL;
- if (!frame || !this || !data) {
+ if (!frame || !data) {
ret = -1;
goto out;
}
@@ -1664,7 +1647,7 @@ glusterd_rpc_friend_remove(call_frame_t *frame, xlator_t *this, void *data)
out:
GF_FREE(req.hostname);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1712,7 +1695,7 @@ out:
if (ret && dummy_frame)
STACK_DESTROY(dummy_frame->root);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1727,9 +1710,6 @@ glusterd_cluster_lock(call_frame_t *frame, xlator_t *this, void *data)
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
- if (!this)
- goto out;
-
peerinfo = data;
priv = this->private;
@@ -1746,7 +1726,7 @@ glusterd_cluster_lock(call_frame_t *frame, xlator_t *this, void *data)
NULL, this, glusterd_cluster_lock_cbk,
(xdrproc_t)xdr_gd1_mgmt_cluster_lock_req);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
if (ret && dummy_frame)
STACK_DESTROY(dummy_frame->root);
@@ -1765,9 +1745,6 @@ glusterd_mgmt_v3_lock_peers(call_frame_t *frame, xlator_t *this, void *data)
dict_t *dict = NULL;
uuid_t *txn_id = NULL;
- if (!this)
- goto out;
-
dict = data;
priv = this->private;
@@ -1824,7 +1801,7 @@ glusterd_mgmt_v3_lock_peers(call_frame_t *frame, xlator_t *this, void *data)
glusterd_mgmt_v3_lock_peers_cbk,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_req);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
if (dict)
dict_unref(dict);
if (req.dict.dict_val)
@@ -1844,9 +1821,6 @@ glusterd_mgmt_v3_unlock_peers(call_frame_t *frame, xlator_t *this, void *data)
dict_t *dict = NULL;
uuid_t *txn_id = NULL;
- if (!this)
- goto out;
-
dict = data;
priv = this->private;
@@ -1903,7 +1877,7 @@ glusterd_mgmt_v3_unlock_peers(call_frame_t *frame, xlator_t *this, void *data)
glusterd_mgmt_v3_unlock_peers_cbk,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_req);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
if (dict)
dict_unref(dict);
@@ -1923,10 +1897,6 @@ glusterd_cluster_unlock(call_frame_t *frame, xlator_t *this, void *data)
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
- if (!this) {
- ret = -1;
- goto out;
- }
peerinfo = data;
priv = this->private;
GF_ASSERT(priv);
@@ -1942,7 +1912,7 @@ glusterd_cluster_unlock(call_frame_t *frame, xlator_t *this, void *data)
NULL, this, glusterd_cluster_unlock_cbk,
(xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
if (ret && dummy_frame)
STACK_DESTROY(dummy_frame->root);
@@ -1964,10 +1934,6 @@ glusterd_stage_op(call_frame_t *frame, xlator_t *this, void *data)
dict_t *dict = NULL;
uuid_t *txn_id = NULL;
- if (!this) {
- goto out;
- }
-
dict = data;
priv = this->private;
@@ -2026,7 +1992,7 @@ out:
if (req.buf.buf_val)
GF_FREE(req.buf.buf_val);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -2044,10 +2010,6 @@ glusterd_commit_op(call_frame_t *frame, xlator_t *this, void *data)
dict_t *dict = NULL;
uuid_t *txn_id = NULL;
- if (!this) {
- goto out;
- }
-
dict = data;
priv = this->private;
GF_ASSERT(priv);
@@ -2105,7 +2067,7 @@ out:
if (req.buf.buf_val)
GF_FREE(req.buf.buf_val);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -2123,12 +2085,10 @@ __glusterd_brick_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
int index = 0;
glusterd_req_ctx_t *req_ctx = NULL;
glusterd_pending_node_t *node = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *txn_id = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -2256,10 +2216,6 @@ glusterd_brick_op(call_frame_t *frame, xlator_t *this, void *data)
dict_t *op_ctx = NULL;
uuid_t *txn_id = NULL;
- if (!this) {
- ret = -1;
- goto out;
- }
priv = this->private;
GF_ASSERT(priv);
@@ -2373,7 +2329,7 @@ out:
ret1 = glusterd_set_txn_opinfo(txn_id, &opinfo);
if (ret1)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set "
"transaction's opinfo");
@@ -2382,7 +2338,7 @@ out:
opinfo.op_ret = ret;
}
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
index c49a0eefba..1d4689968f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
@@ -40,9 +40,8 @@ glusterd_scrubsvc_create_volfile()
};
int ret = -1;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -66,17 +65,18 @@ int
glusterd_scrubsvc_manager(glusterd_svc_t *svc, void *data, int flags)
{
int ret = -EINVAL;
+ xlator_t *this = THIS;
if (!svc->inited) {
ret = glusterd_scrubsvc_init(svc);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SCRUB_INIT_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SCRUB_INIT_FAIL,
"Failed to init "
"scrub service");
goto out;
} else {
svc->inited = _gf_true;
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"scrub service "
"initialized");
}
@@ -105,7 +105,7 @@ glusterd_scrubsvc_manager(glusterd_svc_t *svc, void *data, int flags)
out:
if (ret)
gf_event(EVENT_SVC_MANAGER_FAILED, "svc_name=%s", svc->name);
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -144,13 +144,10 @@ int
glusterd_scrubsvc_reconfigure()
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t identical = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -202,6 +199,6 @@ manager:
ret = priv->scrub_svc.manager(&(priv->scrub_svc), NULL, PROC_START_NO_WAIT);
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
index b0b8a2e401..051a372b95 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
@@ -146,9 +146,7 @@ glusterd_is_quorum_changed(dict_t *options, char *option, char *value)
char *newquorum = NULL;
char *oldratio = NULL;
char *newratio = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
if ((strcmp("all", option) != 0) && !glusterd_is_quorum_option(option))
goto out;
@@ -427,7 +425,7 @@ out:
int
glusterd_do_quorum_action()
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *volinfo = NULL;
int ret = 0;
@@ -435,7 +433,6 @@ glusterd_do_quorum_action()
int quorum_count = 0;
gf_boolean_t meets = _gf_false;
- this = THIS;
conf = this->private;
conf->pending_quorum_action = _gf_true;
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
index 5661e391a9..508873bee3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
@@ -82,13 +82,13 @@ glusterd_shd_svcproc_cleanup(glusterd_shdsvc_t *shd)
glusterd_conf_t *conf = NULL;
gf_boolean_t need_unref = _gf_false;
rpc_clnt_t *rpc = NULL;
-
- conf = THIS->private;
+ xlator_t *this = THIS;
+ conf = this->private;
if (!conf)
return;
- GF_VALIDATE_OR_GOTO(THIS->name, conf, out);
- GF_VALIDATE_OR_GOTO(THIS->name, shd, out);
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ GF_VALIDATE_OR_GOTO(this->name, shd, out);
svc = &shd->svc;
shd->attached = _gf_false;
@@ -132,10 +132,8 @@ glusterd_svc_set_shd_pidfile(glusterd_volinfo_t *volinfo, dict_t *dict)
{
int ret = -1;
glusterd_svc_t *svc = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
index 1c56384a14..e8c01ab825 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
@@ -64,13 +64,10 @@ glusterd_shdsvc_init(void *data, glusterd_conn_t *mux_conn,
glusterd_volinfo_t *volinfo = NULL;
glusterd_conf_t *priv = NULL;
glusterd_muxsvc_conn_notify_t notify = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volfileserver = NULL;
int32_t len = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -142,7 +139,7 @@ glusterd_shdsvc_init(void *data, glusterd_conn_t *mux_conn,
goto out;
out:
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -156,7 +153,6 @@ glusterd_shdsvc_create_volfile(glusterd_volinfo_t *volinfo)
int ret = -1;
dict_t *mod_dict = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
glusterd_svc_build_shd_volfile_path(volinfo, filepath, PATH_MAX);
if (!glusterd_is_shd_compatible_volume(volinfo)) {
@@ -363,7 +359,6 @@ glusterd_new_shd_svc_start(glusterd_svc_t *svc, int flags)
char client_pid[32] = {0};
dict_t *cmdline = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
cmdline = dict_new();
if (!cmdline)
@@ -541,14 +536,11 @@ int
glusterd_shdsvc_reconfigure(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t identical = _gf_false;
dict_t *mod_dict = NULL;
glusterd_svc_t *svc = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
if (!volinfo) {
/* reconfigure will be called separately*/
ret = 0;
@@ -660,7 +652,7 @@ out:
glusterd_volinfo_unref(volinfo);
if (mod_dict)
dict_unref(mod_dict);
- gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -674,8 +666,6 @@ glusterd_shdsvc_restart()
glusterd_conf_t *conf = NULL;
glusterd_svc_t *svc = NULL;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -717,8 +707,9 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
gf_boolean_t empty = _gf_false;
glusterd_conf_t *conf = NULL;
int pid = -1;
+ xlator_t *this = THIS;
- conf = THIS->private;
+ conf = this->private;
GF_VALIDATE_OR_GOTO("glusterd", conf, out);
GF_VALIDATE_OR_GOTO("glusterd", svc, out);
svc_proc = svc->svc_proc;
@@ -754,7 +745,7 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
pthread_mutex_lock(&conf->attach_lock);
{
if (!gf_is_service_running(svc->proc.pidfile, &pid)) {
- gf_msg_debug(THIS->name, 0, "shd isn't running");
+ gf_msg_debug(this->name, 0, "shd isn't running");
}
cds_list_del_init(&svc->mux_svc);
empty = cds_list_empty(&svc_proc->svcs);
@@ -777,11 +768,11 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
if (!empty && pid != -1) {
ret = glusterd_detach_svc(svc, volinfo, sig);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
"shd service is failed to detach volume %s from pid %d",
volinfo->volname, glusterd_proc_get_pid(&svc->proc));
else
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_SVC_STOP_SUCCESS,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_SVC_STOP_SUCCESS,
"Shd service is detached for volume %s from pid %d",
volinfo->volname, glusterd_proc_get_pid(&svc->proc));
}
@@ -791,6 +782,6 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
ret = 0;
glusterd_volinfo_unref(volinfo);
out:
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 83aa65abc5..23e7ed3b78 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -126,7 +126,7 @@ glusterd_broadcast_friend_delete(char *hostname, uuid_t uuid)
{
int ret = 0;
rpc_clnt_procedure_t *proc = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_friend_update_ctx_t ctx = {
{0},
};
@@ -139,7 +139,6 @@ glusterd_broadcast_friend_delete(char *hostname, uuid_t uuid)
int keylen;
int32_t count = 0;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -311,11 +310,10 @@ glusterd_ac_friend_add(glusterd_friend_sm_event_t *event, void *ctx)
rpc_clnt_procedure_t *proc = NULL;
call_frame_t *frame = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(event);
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -362,7 +360,7 @@ glusterd_ac_friend_probe(glusterd_friend_sm_event_t *event, void *ctx)
rpc_clnt_procedure_t *proc = NULL;
call_frame_t *frame = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_probe_ctx_t *probe_ctx = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
@@ -371,10 +369,6 @@ glusterd_ac_friend_probe(glusterd_friend_sm_event_t *event, void *ctx)
probe_ctx = ctx;
- this = THIS;
-
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -462,14 +456,13 @@ glusterd_ac_send_friend_remove_req(glusterd_friend_sm_event_t *event,
rpc_clnt_procedure_t *proc = NULL;
call_frame_t *frame = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE;
glusterd_probe_ctx_t *ctx = NULL;
glusterd_friend_sm_event_t *new_event = NULL;
GF_ASSERT(event);
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -557,7 +550,7 @@ glusterd_ac_send_friend_update(glusterd_friend_sm_event_t *event, void *ctx)
glusterd_peerinfo_t *cur_peerinfo = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
rpc_clnt_procedure_t *proc = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_friend_update_ctx_t ev_ctx = {{0}};
glusterd_conf_t *priv = NULL;
dict_t *friends = NULL;
@@ -569,7 +562,6 @@ glusterd_ac_send_friend_update(glusterd_friend_sm_event_t *event, void *ctx)
GF_ASSERT(event);
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -665,7 +657,7 @@ glusterd_ac_update_friend(glusterd_friend_sm_event_t *event, void *ctx)
glusterd_peerinfo_t *cur_peerinfo = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
rpc_clnt_procedure_t *proc = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_friend_update_ctx_t ev_ctx = {{0}};
glusterd_conf_t *priv = NULL;
dict_t *friends = NULL;
@@ -677,7 +669,6 @@ glusterd_ac_update_friend(glusterd_friend_sm_event_t *event, void *ctx)
GF_ASSERT(event);
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -956,12 +947,9 @@ glusterd_ac_handle_friend_add_req(glusterd_friend_sm_event_t *event, void *ctx)
int status = 0;
int32_t op_ret = -1;
int32_t op_errno = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *hostname = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(ctx);
ev_ctx = ctx;
gf_uuid_copy(uuid, ev_ctx->uuid);
@@ -1461,11 +1449,9 @@ glusterd_friend_sm()
gf_boolean_t is_await_conn = _gf_false;
gf_boolean_t quorum_action = _gf_false;
glusterd_friend_sm_state_t old_state = GD_FRIEND_STATE_DEFAULT;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index d75f249b29..3f54af414f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -72,13 +72,10 @@ glusterd_snapdsvc_init(void *data)
glusterd_volinfo_t *volinfo = NULL;
glusterd_conf_t *priv = NULL;
glusterd_conn_notify_t notify = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volfileserver = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -148,14 +145,14 @@ glusterd_snapdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
if (!svc->inited) {
ret = glusterd_snapdsvc_init(volinfo);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SNAPD_INIT_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SNAPD_INIT_FAIL,
"Failed to initialize "
"snapd service for volume %s",
volinfo->volname);
goto out;
} else {
svc->inited = _gf_true;
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"snapd service "
"initialized");
}
@@ -225,7 +222,7 @@ out:
gf_event(EVENT_SVC_MANAGER_FAILED, "volume=%s;svc_name=%s",
volinfo->volname, svc->name);
}
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -238,7 +235,7 @@ glusterd_snapdsvc_start(glusterd_svc_t *svc, int flags)
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char valgrind_logfile[PATH_MAX] = {0};
int snapd_port = 0;
char msg[1024] = {
@@ -252,9 +249,6 @@ glusterd_snapdsvc_start(glusterd_svc_t *svc, int flags)
char *localtime_logging = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -382,8 +376,6 @@ glusterd_snapdsvc_restart()
glusterd_conf_t *conf = NULL;
glusterd_svc_t *svc = NULL;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -413,13 +405,10 @@ glusterd_snapdsvc_rpc_notify(glusterd_conn_t *conn, rpc_clnt_event_t event)
{
int ret = 0;
glusterd_svc_t *svc = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *volinfo = NULL;
glusterd_snapdsvc_t *snapd = NULL;
- this = THIS;
- GF_ASSERT(this);
-
svc = cds_list_entry(conn, glusterd_svc_t, conn);
if (!svc) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_GET_FAIL,
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 8e406068cd..f058c80ff7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -70,14 +70,11 @@ glusterd_cleanup_snaps_for_volume(glusterd_volinfo_t *volinfo)
{
int32_t op_ret = 0;
int32_t ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *dummy_snap_vol = NULL;
glusterd_snap_t *snap = NULL;
- this = THIS;
- GF_ASSERT(this);
-
cds_list_for_each_entry_safe(snap_vol, dummy_snap_vol,
&volinfo->snap_volumes, snapvol_list)
{
@@ -137,12 +134,10 @@ glusterd_snap_geo_rep_restore(glusterd_volinfo_t *snap_volinfo,
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int geo_rep_indexing_on = 0;
int ret = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap_volinfo);
GF_ASSERT(new_volinfo);
@@ -203,12 +198,10 @@ glusterd_snap_volinfo_restore(dict_t *dict, dict_t *rsp_dict,
char key[64] = "";
int32_t brick_count = -1;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_brickinfo_t *new_brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -342,12 +335,11 @@ glusterd_snap_volinfo_find_by_volume_id(uuid_t volume_id,
glusterd_volinfo_t **volinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *voliter = NULL;
glusterd_snap_t *snap = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volinfo);
@@ -382,11 +374,10 @@ glusterd_snap_volinfo_find(char *snap_volname, glusterd_snap_t *snap,
glusterd_volinfo_t **volinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(snap);
@@ -414,11 +405,10 @@ glusterd_snap_volinfo_find_from_parent_volname(char *origin_volname,
glusterd_volinfo_t **volinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(snap);
@@ -453,14 +443,12 @@ gd_add_brick_snap_details_to_dict(dict_t *dict, char *prefix,
glusterd_brickinfo_t *brickinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[256] = {
0,
};
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -530,14 +518,12 @@ gd_add_vol_snap_details_to_dict(dict_t *dict, char *prefix,
glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[256] = {
0,
};
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -606,10 +592,8 @@ glusterd_add_missed_snaps_to_export_dict(dict_t *peer_data)
glusterd_conf_t *priv = NULL;
glusterd_missed_snap_info *missed_snapinfo = NULL;
glusterd_snap_op_t *snap_opinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
priv = this->private;
@@ -663,10 +647,8 @@ glusterd_add_snap_to_dict(glusterd_snap_t *snap, dict_t *peer_data,
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
gf_boolean_t host_bricks = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap);
GF_ASSERT(peer_data);
@@ -783,10 +765,8 @@ glusterd_add_snapshots_to_export_dict(dict_t *peer_data)
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(peer_data);
@@ -825,7 +805,7 @@ gd_import_new_brick_snap_details(dict_t *dict, char *prefix,
glusterd_brickinfo_t *brickinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[512] = {
0,
@@ -835,8 +815,6 @@ gd_import_new_brick_snap_details(dict_t *dict, char *prefix,
char *mnt_opts = NULL;
char *mount_dir = NULL;
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -909,15 +887,13 @@ gd_import_volume_snap_details(dict_t *dict, glusterd_volinfo_t *volinfo,
char *prefix, char *volname)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char key[256] = {
0,
};
char *restored_snap = NULL;
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -975,13 +951,10 @@ glusterd_perform_missed_op(glusterd_snap_t *snap, int32_t op)
glusterd_volinfo_t *snap_volinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *tmp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t null_uuid = {0};
char *parent_volname = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(snap);
@@ -1109,10 +1082,7 @@ glusterd_perform_missed_snap_ops()
uuid_t snap_uuid = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -1181,10 +1151,8 @@ glusterd_import_friend_missed_snap_list(dict_t *peer_data)
int32_t missed_snap_count = -1;
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
priv = this->private;
@@ -1244,10 +1212,8 @@ glusterd_check_peer_has_higher_snap_version(dict_t *peer_data,
char key[256] = {0};
int version = 0, i = 0;
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap);
GF_ASSERT(peer_data);
@@ -1309,10 +1275,8 @@ glusterd_is_peer_snap_conflicting(char *peer_snap_name, char *peer_snap_id,
uuid_t peer_snap_uuid = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_snap_name);
GF_ASSERT(peer_snap_id);
GF_ASSERT(conflict);
@@ -1357,10 +1321,7 @@ glusterd_are_snap_bricks_local(glusterd_snap_t *snap)
gf_boolean_t is_local = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap);
cds_list_for_each_entry(volinfo, &snap->volumes, vol_list)
@@ -1375,7 +1336,7 @@ glusterd_are_snap_bricks_local(glusterd_snap_t *snap)
}
out:
- gf_msg_trace(this->name, 0, "Returning %d", is_local);
+ gf_msg_trace(THIS->name, 0, "Returning %d", is_local);
return is_local;
}
@@ -1390,10 +1351,8 @@ glusterd_peer_has_missed_snap_delete(uuid_t peerid, char *peer_snap_id)
glusterd_conf_t *priv = NULL;
glusterd_missed_snap_info *missed_snapinfo = NULL;
glusterd_snap_op_t *snap_opinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(peer_snap_id);
@@ -1434,11 +1393,9 @@ int32_t
glusterd_gen_snap_volfiles(glusterd_volinfo_t *snap_vol, char *peer_snap_name)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *parent_volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap_vol);
GF_ASSERT(peer_snap_name);
@@ -1515,11 +1472,9 @@ glusterd_import_friend_snap(dict_t *peer_data, int32_t snap_count,
int32_t ret = -1;
int32_t volcount = -1;
int32_t i = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int64_t time_stamp;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(peer_data);
@@ -1607,7 +1562,7 @@ glusterd_import_friend_snap(dict_t *peer_data, int32_t snap_count,
ret = glusterd_store_create_snap_dir(snap);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SNAPDIR_CREATE_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SNAPDIR_CREATE_FAIL,
"Failed to create snap dir");
goto out;
}
@@ -1754,10 +1709,8 @@ glusterd_compare_snap(dict_t *peer_data, int32_t snap_count, char *peername,
gf_boolean_t missed_delete = _gf_false;
int32_t ret = -1;
int32_t volcount = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
GF_ASSERT(peername);
@@ -1932,7 +1885,7 @@ glusterd_update_snaps_synctask(void *opaque)
int32_t ret = -1;
int32_t snap_count = 0;
int i = 1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *peer_data = NULL;
char buf[64] = "";
char prefix[32] = "";
@@ -1947,9 +1900,6 @@ glusterd_update_snaps_synctask(void *opaque)
dict_t *dict = NULL;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -2082,11 +2032,9 @@ glusterd_compare_friend_snapshots(dict_t *peer_data, char *peername,
int32_t ret = -1;
int32_t snap_count = 0;
int i = 1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *peer_data_copy = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
GF_ASSERT(peername);
@@ -2136,14 +2084,11 @@ glusterd_add_snapd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict,
char key[64] = {0};
char base_key[32] = {0};
char pidfile[PATH_MAX] = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
-
snprintf(base_key, sizeof(base_key), "brick%d", count);
snprintf(key, sizeof(key), "%s.hostname", base_key);
ret = dict_set_str(dict, key, "Snapshot Daemon");
@@ -2363,12 +2308,9 @@ glusterd_merge_brick_status(dict_t *dst, dict_t *src)
char *clonename = NULL;
int ret = -1;
int32_t brick_online = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t snap_command = 0;
- this = THIS;
- GF_ASSERT(this);
-
if (!dst || !src) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_EMPTY,
"Source or Destination "
@@ -2473,12 +2415,9 @@ glusterd_snap_create_use_rsp_dict(dict_t *dst, dict_t *src)
int32_t ret = -1;
int32_t src_missed_snap_count = -1;
int32_t dst_missed_snap_count = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int8_t soft_limit_flag = -1;
- this = THIS;
- GF_ASSERT(this);
-
if (!dst || !src) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_EMPTY,
"Source or Destination "
@@ -2673,10 +2612,8 @@ glusterd_missed_snapinfo_new(glusterd_missed_snap_info **missed_snapinfo)
{
glusterd_missed_snap_info *new_missed_snapinfo = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(missed_snapinfo);
new_missed_snapinfo = GF_CALLOC(1, sizeof(*new_missed_snapinfo),
@@ -2704,10 +2641,8 @@ glusterd_missed_snap_op_new(glusterd_snap_op_t **snap_op)
{
glusterd_snap_op_t *new_snap_op = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap_op);
new_snap_op = GF_CALLOC(1, sizeof(*new_snap_op),
@@ -2772,11 +2707,9 @@ glusterd_mount_lvm_snapshot(glusterd_brickinfo_t *brickinfo,
runner_t runner = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick_mount_path);
GF_ASSERT(brickinfo);
@@ -2837,10 +2770,8 @@ glusterd_volume_quorum_calculate(glusterd_volinfo_t *volinfo, dict_t *dict,
{
gf_boolean_t quorum_met = _gf_false;
const char err_str[] = "One or more bricks may be down.";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!volinfo || !dict) {
@@ -2876,7 +2807,7 @@ glusterd_volume_quorum_check(glusterd_volinfo_t *volinfo, int64_t index,
uint32_t *op_errno)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int64_t i = 0;
int64_t j = 0;
char key[128] = {
@@ -2891,8 +2822,6 @@ glusterd_volume_quorum_check(glusterd_volinfo_t *volinfo, int64_t index,
int32_t brick_online = 0;
const char err_str[] = "quorum is not met";
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -2981,10 +2910,8 @@ glusterd_snap_common_quorum_calculate(glusterd_volinfo_t *volinfo, dict_t *dict,
char *quorum_type = NULL;
int32_t tmp = 0;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
@@ -3082,10 +3009,8 @@ glusterd_snap_quorum_check_for_clone(dict_t *dict, gf_boolean_t snap_volume,
int64_t volcount = 0;
int64_t i = 0;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!dict) {
@@ -3203,10 +3128,8 @@ glusterd_snap_quorum_check_for_create(dict_t *dict, gf_boolean_t snap_volume,
};
int64_t i = 0;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!dict) {
@@ -3312,12 +3235,10 @@ glusterd_snap_quorum_check(dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr, uint32_t *op_errno)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t snap_command = 0;
const char err_str[] = "glusterds are not in quorum";
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!dict) {
@@ -3408,7 +3329,6 @@ glusterd_snap_unmount(xlator_t *this, glusterd_volinfo_t *volinfo)
int32_t ret = -1;
int retry_count = 0;
- GF_ASSERT(this);
GF_ASSERT(volinfo);
cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
@@ -3465,10 +3385,8 @@ glusterd_umount(const char *path)
runner_t runner = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(path);
if (!glusterd_is_path_mounted(path)) {
@@ -3492,7 +3410,7 @@ int32_t
glusterd_copy_file(const char *source, const char *destination)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char buffer[1024] = "";
int src_fd = -1;
int dest_fd = -1;
@@ -3502,9 +3420,6 @@ glusterd_copy_file(const char *source, const char *destination)
};
mode_t dest_mode = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(source);
GF_ASSERT(destination);
@@ -3569,7 +3484,7 @@ int32_t
glusterd_copy_folder(const char *source, const char *destination)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
DIR *dir_ptr = NULL;
struct dirent *entry = NULL;
struct dirent scratch[2] = {
@@ -3584,9 +3499,6 @@ glusterd_copy_folder(const char *source, const char *destination)
0,
};
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(source);
GF_ASSERT(destination);
@@ -3649,20 +3561,16 @@ glusterd_get_geo_rep_session(char *secondary_key, char *origin_volname,
char *ip_i = NULL;
char *ip_temp = NULL;
char *buffer = NULL;
- xlator_t *this = NULL;
char *secondary_temp = NULL;
char *save_ptr = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(secondary_key);
GF_ASSERT(origin_volname);
GF_ASSERT(gsync_secondaries_dict);
ret = dict_get_str(gsync_secondaries_dict, secondary_key, &buffer);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to "
"get value for key %s",
secondary_key);
@@ -3754,14 +3662,12 @@ glusterd_copy_quota_files(glusterd_volinfo_t *src_vol,
char dest_dir[PATH_MAX] = "";
char src_path[PATH_MAX] = "";
char dest_path[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
struct stat stbuf = {
0,
};
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -3860,7 +3766,7 @@ glusterd_copy_nfs_ganesha_file(glusterd_volinfo_t *src_vol,
char *find_ptr = NULL;
char *buff_ptr = NULL;
char *tmp_ptr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
struct stat stbuf = {
0,
@@ -3868,8 +3774,6 @@ glusterd_copy_nfs_ganesha_file(glusterd_volinfo_t *src_vol,
FILE *src = NULL;
FILE *dest = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("snapshot", this, out);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -3981,7 +3885,7 @@ glusterd_restore_geo_rep_files(glusterd_volinfo_t *snap_vol)
int32_t ret = -1;
char src_path[PATH_MAX] = "";
char dest_path[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *origin_volname = NULL;
glusterd_volinfo_t *origin_vol = NULL;
int i = 0;
@@ -3991,8 +3895,6 @@ glusterd_restore_geo_rep_files(glusterd_volinfo_t *snap_vol)
char snapgeo_dir[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4072,14 +3974,12 @@ glusterd_restore_nfs_ganesha_file(glusterd_volinfo_t *src_vol,
char snap_dir[PATH_MAX] = "";
char src_path[PATH_MAX] = "";
char dest_path[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
struct stat stbuf = {
0,
};
- this = THIS;
- GF_VALIDATE_OR_GOTO("snapshot", this, out);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -4127,18 +4027,17 @@ int
glusterd_is_snapd_enabled(glusterd_volinfo_t *volinfo)
{
int ret = 0;
- xlator_t *this = THIS;
ret = dict_get_str_boolean(volinfo->dict, "features.uss", -2);
if (ret == -2) {
- gf_msg_debug(this->name, 0,
+ gf_msg_debug(THIS->name, 0,
"Key features.uss not "
"present in the dict for volume %s",
volinfo->volname);
ret = 0;
} else if (ret == -1) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get 'features.uss'"
" from dict for volume %s",
volinfo->volname);
@@ -4156,14 +4055,12 @@ glusterd_is_snap_soft_limit_reached(glusterd_volinfo_t *volinfo, dict_t *dict)
uint64_t limit = 0;
int auto_delete = 0;
uint64_t effective_max_limit = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
GF_ASSERT(volinfo);
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4222,10 +4119,7 @@ void
gd_get_snap_conf_values_if_present(dict_t *dict, uint64_t *sys_hard_limit,
uint64_t *sys_soft_limit)
{
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 4df238f91b..c38c3e9d48 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -114,15 +114,13 @@ glusterd_build_snap_device_path(char *device, char *snapname,
char msg[1024] = "";
char volgroup[PATH_MAX] = "";
char *snap_device = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
runner_t runner = {
0,
};
char *ptr = NULL;
int ret = -1;
- this = THIS;
- GF_ASSERT(this);
if (!device) {
gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
"device is NULL");
@@ -182,12 +180,10 @@ glusterd_find_missed_snap(dict_t *rsp_dict, glusterd_volinfo_t *vol,
{
int32_t brick_count = -1;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(peers);
GF_ASSERT(vol);
@@ -252,15 +248,12 @@ snap_max_limits_display_commit(dict_t *rsp_dict, char *volname, char *op_errstr,
uint64_t snap_max_limit = 0;
uint64_t soft_limit_value = -1;
uint64_t count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
uint64_t opt_soft_max = GLUSTERD_SNAPS_DEF_SOFT_LIMIT_PERCENT;
char *auto_delete = "disable";
char *snap_activate = "disable";
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(op_errstr);
@@ -497,14 +490,12 @@ glusterd_copy_geo_rep_session_files(char *session, glusterd_volinfo_t *snap_vol)
struct dirent **files = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int i = 0;
char src_path[PATH_MAX] = "";
char dest_path[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -621,11 +612,9 @@ glusterd_snapshot_backup_vol(glusterd_volinfo_t *volinfo)
char delete_path[PATH_MAX] = "";
char trashdir[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volinfo);
@@ -716,15 +705,13 @@ glusterd_copy_geo_rep_files(glusterd_volinfo_t *origin_vol,
{
int32_t ret = -1;
int i = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char key[32] = "";
char session[PATH_MAX] = "";
char secondary[PATH_MAX] = "";
char snapgeo_dir[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -792,16 +779,13 @@ glusterd_snapshot_restore(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int ret = -1;
int32_t volcount = -1;
char *snapname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *snap_volinfo = NULL;
glusterd_volinfo_t *tmp = NULL;
glusterd_volinfo_t *parent_volinfo = NULL;
glusterd_snap_t *snap = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
@@ -948,11 +932,8 @@ glusterd_snapshot_restore_prevalidate(dict_t *dict, char **op_errstr,
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -1157,12 +1138,9 @@ snap_max_hard_limits_validate(dict_t *dict, char *volname, uint64_t value,
glusterd_volinfo_t *volinfo = NULL;
int ret = -1;
uint64_t max_limit = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
@@ -1233,7 +1211,7 @@ glusterd_snapshot_config_prevalidate(dict_t *dict, char **op_errstr,
{
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
int config_command = 0;
char err_str[PATH_MAX] = "";
@@ -1247,9 +1225,6 @@ glusterd_snapshot_config_prevalidate(dict_t *dict, char **op_errstr,
int32_t cur_snap_activate = 0;
int32_t req_snap_activate = 0;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -1411,12 +1386,9 @@ glusterd_handle_snapshot_config(rpcsvc_request_t *req, glusterd_op_t op,
{
int32_t ret = -1;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int config_command = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_VALIDATE_OR_GOTO(this->name, req, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
@@ -1495,11 +1467,9 @@ glusterd_snap_create_clone_pre_val_use_rsp_dict(dict_t *dst, dict_t *src)
int64_t volume_count = 0;
int64_t brick_count = 0;
int64_t brick_order = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t brick_online = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dst);
GF_ASSERT(src);
@@ -1647,10 +1617,7 @@ glusterd_snap_restore_use_rsp_dict(dict_t *dst, dict_t *src)
int32_t vol_count = -1;
int32_t brickcount = -1;
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!dst || !src) {
gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
@@ -1759,10 +1726,7 @@ glusterd_snap_pre_validate_use_rsp_dict(dict_t *dst, dict_t *src)
{
int ret = -1;
int32_t snap_command = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (!dst || !src) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY,
@@ -1817,7 +1781,7 @@ glusterd_add_brick_status_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo,
char pidfile[PATH_MAX] = "";
int32_t brick_online = 0;
pid_t pid = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = -1;
@@ -1825,8 +1789,6 @@ glusterd_add_brick_status_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo,
GF_ASSERT(volinfo);
GF_ASSERT(brickinfo);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1868,15 +1830,12 @@ glusterd_is_thinp_brick(char *device, uint32_t *op_errno)
char msg[1024] = "";
char pool_name[PATH_MAX] = "";
char *ptr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
runner_t runner = {
0,
};
gf_boolean_t is_thin = _gf_false;
- this = THIS;
-
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, device, out);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -1943,12 +1902,11 @@ glusterd_snap_create_clone_common_prevalidate(
int64_t i = 1;
int64_t brick_order = 0;
int64_t brick_count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
int32_t len = 0;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -2167,12 +2125,11 @@ glusterd_snapshot_clone_prevalidate(dict_t *dict, char **op_errstr,
int ret = -1;
int64_t volcount = 1;
glusterd_volinfo_t *snap_vol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *snap_volid = NULL;
gf_loglevel_t loglevel = GF_LOG_ERROR;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
GF_ASSERT(op_errstr);
GF_ASSERT(dict);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -2286,7 +2243,7 @@ glusterd_snapshot_create_prevalidate(dict_t *dict, char **op_errstr,
int64_t i = 0;
int64_t volcount = 0;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *snap_volid = NULL;
gf_loglevel_t loglevel = GF_LOG_ERROR;
glusterd_conf_t *conf = NULL;
@@ -2295,7 +2252,6 @@ glusterd_snapshot_create_prevalidate(dict_t *dict, char **op_errstr,
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
char *description = NULL;
- this = THIS;
GF_ASSERT(op_errstr);
conf = this->private;
GF_ASSERT(conf);
@@ -2595,7 +2551,7 @@ glusterd_do_lvm_snapshot_remove(glusterd_volinfo_t *snap_vol,
const char *mount_pt, const char *snap_device)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
runner_t runner = {
0,
@@ -2608,8 +2564,6 @@ glusterd_do_lvm_snapshot_remove(glusterd_volinfo_t *snap_vol,
gf_boolean_t unmount = _gf_true;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -2727,7 +2681,7 @@ glusterd_lvm_snapshot_remove(dict_t *rsp_dict, glusterd_volinfo_t *snap_vol)
int32_t ret = -1;
int32_t err = 0;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char brick_dir[PATH_MAX] = "";
char snap_path[PATH_MAX] = "";
char *tmp = NULL;
@@ -2737,8 +2691,6 @@ glusterd_lvm_snapshot_remove(dict_t *rsp_dict, glusterd_volinfo_t *snap_vol)
0,
};
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(snap_vol);
if ((snap_vol->is_snap_volume == _gf_false) &&
@@ -2932,10 +2884,8 @@ glusterd_snap_volume_remove(dict_t *rsp_dict, glusterd_volinfo_t *snap_vol,
int save_ret = 0;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *origin_vol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(snap_vol);
@@ -3023,10 +2973,8 @@ glusterd_snap_remove(dict_t *rsp_dict, glusterd_snap_t *snap,
int save_ret = 0;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(snap);
@@ -3092,10 +3040,9 @@ glusterd_snapshot_get_snapvol_detail(dict_t *dict, glusterd_volinfo_t *snap_vol,
char *value = NULL;
glusterd_volinfo_t *origin_vol = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -3261,9 +3208,7 @@ glusterd_snapshot_get_snap_detail(dict_t *dict, glusterd_snap_t *snap,
char *value = NULL;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
GF_ASSERT(snap);
@@ -3423,9 +3368,8 @@ glusterd_snapshot_get_all_snap_info(dict_t *dict)
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -3471,10 +3415,9 @@ glusterd_snapshot_get_info_by_volume(dict_t *dict, char *volname, char *err_str,
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
- this = THIS;
conf = this->private;
GF_ASSERT(conf);
@@ -3596,12 +3539,9 @@ glusterd_handle_snapshot_info(rpcsvc_request_t *req, glusterd_op_t op,
char *volname = NULL;
char *snapname = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t cmd = GF_SNAP_INFO_TYPE_ALL;
- this = THIS;
- GF_ASSERT(this);
-
GF_VALIDATE_OR_GOTO(this->name, req, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
@@ -3716,9 +3656,8 @@ glusterd_snapshot_get_all_snapnames(dict_t *dict)
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(dict);
@@ -3767,9 +3706,8 @@ glusterd_snapshot_get_vol_snapnames(dict_t *dict, glusterd_volinfo_t *volinfo)
char key[32] = "";
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
GF_ASSERT(dict);
GF_ASSERT(volinfo);
@@ -3812,9 +3750,7 @@ glusterd_handle_snapshot_list(rpcsvc_request_t *req, glusterd_op_t op,
int ret = -1;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, req, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
@@ -3884,7 +3820,7 @@ glusterd_handle_snapshot_create(rpcsvc_request_t *req, glusterd_op_t op,
char *volname = NULL;
char *snapname = NULL;
int64_t volcount = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char key[64] = "";
int keylen;
char *username = NULL;
@@ -3897,8 +3833,6 @@ glusterd_handle_snapshot_create(rpcsvc_request_t *req, glusterd_op_t op,
char new_snapname[GLUSTERD_MAX_SNAP_NAME] = "";
char gmt_snaptime[GLUSTERD_MAX_SNAP_NAME] = "";
time_t snap_time;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
GF_ASSERT(err_str);
@@ -4078,10 +4012,6 @@ glusterd_handle_snapshot_status(rpcsvc_request_t *req, glusterd_op_t op,
dict_t *dict, char *err_str, size_t len)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
@@ -4089,7 +4019,7 @@ glusterd_handle_snapshot_status(rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_initiate_snap_phases(req, op, dict);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_INIT_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_INIT_FAIL,
"Failed to initiate "
"snap phases");
goto out;
@@ -4119,7 +4049,7 @@ glusterd_handle_snapshot_clone(rpcsvc_request_t *req, glusterd_op_t op,
int ret = -1;
char *clonename = NULL;
char *snapname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char key[64] = "";
int keylen;
char *username = NULL;
@@ -4130,8 +4060,6 @@ glusterd_handle_snapshot_clone(rpcsvc_request_t *req, glusterd_op_t op,
int i = 0;
char snap_volname[GD_VOLUME_NAME_MAX] = "";
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(dict);
GF_ASSERT(err_str);
@@ -4271,15 +4199,13 @@ glusterd_handle_snapshot_restore(rpcsvc_request_t *req, glusterd_op_t op,
char *snapname = NULL;
char *buf = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
int32_t i = 0;
char key[64] = "";
int keylen;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -4353,12 +4279,11 @@ glusterd_create_snap_object(dict_t *dict, dict_t *rsp_dict)
uuid_t *snap_id = NULL;
char *description = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int ret = -1;
int64_t time_stamp = 0;
- this = THIS;
priv = this->private;
GF_ASSERT(dict);
@@ -4399,7 +4324,7 @@ glusterd_create_snap_object(dict_t *dict, dict_t *rsp_dict)
{
if (!strcmp(snap->snapname, snapname) ||
!gf_uuid_compare(snap->snap_id, *snap_id)) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_CREATION_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_CREATION_FAIL,
"Found duplicate snap %s (%s)", snap->snapname,
uuid_utoa(snap->snap_id));
ret = -1;
@@ -4478,11 +4403,9 @@ glusterd_add_missed_snaps_to_dict(dict_t *rsp_dict,
char name_buf[PATH_MAX] = "";
int32_t missed_snap_count = -1;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(snap_vol);
GF_ASSERT(brickinfo);
@@ -4561,10 +4484,8 @@ glusterd_take_lvm_snapshot(glusterd_brickinfo_t *brickinfo,
runner_t runner = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickinfo);
GF_ASSERT(origin_brick_path);
@@ -4636,7 +4557,7 @@ glusterd_snap_brick_create(glusterd_volinfo_t *snap_volinfo,
int32_t clone)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char snap_brick_mount_path[PATH_MAX] = "";
char clone_uuid[64] = "";
struct stat statbuf = {
@@ -4644,8 +4565,6 @@ glusterd_snap_brick_create(glusterd_volinfo_t *snap_volinfo,
};
int32_t len = 0;
- this = THIS;
-
GF_ASSERT(snap_volinfo);
GF_ASSERT(brickinfo);
@@ -4738,12 +4657,10 @@ glusterd_add_brick_to_snap_volume(dict_t *dict, dict_t *rsp_dict,
glusterd_brickinfo_t *snap_brickinfo = NULL;
gf_boolean_t add_missed_snap = _gf_false;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char abspath[PATH_MAX] = "";
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_ASSERT(snap_vol);
@@ -4948,11 +4865,9 @@ glusterd_update_fs_label(glusterd_brickinfo_t *brickinfo)
runner_t runner = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickinfo);
/* Generate a new UUID */
@@ -5033,12 +4948,10 @@ glusterd_take_brick_snapshot(dict_t *dict, glusterd_volinfo_t *snap_vol,
int keylen;
int32_t ret = -1;
gf_boolean_t snap_activate = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
priv = this->private;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(snap_vol);
GF_ASSERT(brickinfo);
@@ -5185,7 +5098,7 @@ glusterd_do_snap_vol(glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
uuid_t *snap_volid = NULL;
int32_t ret = -1;
int32_t brick_count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *clonename = NULL;
gf_boolean_t conf_present = _gf_false;
int i = 0;
@@ -5197,9 +5110,6 @@ glusterd_do_snap_vol(glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
{.key = "features.quota-deem-statfs", .value = NULL},
{.key = NULL, .value = NULL}};
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(dict);
@@ -5482,7 +5392,7 @@ glusterd_snapshot_activate_deactivate_prevalidate(dict_t *dict,
{
int32_t ret = -1;
char *snapname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
char err_str[PATH_MAX] = "";
@@ -5490,8 +5400,6 @@ glusterd_snapshot_activate_deactivate_prevalidate(dict_t *dict,
glusterd_volume_status volume_status = GLUSTERD_STATUS_STOPPED;
int flags = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!dict || !op_errstr) {
@@ -5589,11 +5497,9 @@ glusterd_handle_snapshot_delete_vol(dict_t *dict, char *err_str,
{
int32_t ret = -1;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *volname = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -5637,10 +5543,9 @@ glusterd_handle_snapshot_delete_all(dict_t *dict)
glusterd_conf_t *priv = NULL;
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -5694,10 +5599,7 @@ glusterd_handle_snapshot_delete_type_snap(rpcsvc_request_t *req,
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(req);
GF_ASSERT(dict);
@@ -5782,13 +5684,9 @@ glusterd_handle_snapshot_delete(rpcsvc_request_t *req, glusterd_op_t op,
size_t len)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t delete_cmd = -1;
- this = THIS;
-
- GF_ASSERT(this);
-
GF_ASSERT(req);
GF_ASSERT(dict);
GF_ASSERT(err_str);
@@ -5863,11 +5761,9 @@ glusterd_snapshot_remove_prevalidate(dict_t *dict, char **op_errstr,
{
int32_t ret = -1;
char *snapname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_snap_t *snap = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
if (!dict || !op_errstr) {
@@ -5915,13 +5811,11 @@ glusterd_snapshot_status_prevalidate(dict_t *dict, char **op_errstr,
int ret = -1;
char *snapname = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t cmd = -1;
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
GF_ASSERT(op_errstr);
@@ -6018,12 +5912,10 @@ glusterd_snapshot_activate_commit(dict_t *dict, char **op_errstr,
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int flags = 0;
int brick_count = -1;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_ASSERT(op_errstr);
@@ -6118,11 +6010,9 @@ glusterd_snapshot_deactivate_commit(dict_t *dict, char **op_errstr,
char *snapname = NULL;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char snap_path[PATH_MAX] = "";
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_ASSERT(op_errstr);
@@ -6214,10 +6104,8 @@ glusterd_snapshot_remove_commit(dict_t *dict, char **op_errstr,
glusterd_snap_t *snap = NULL;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_ASSERT(op_errstr);
@@ -6332,12 +6220,10 @@ glusterd_do_snap_cleanup(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int32_t ret = -1;
char *name = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_snap_t *snap = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -6403,10 +6289,8 @@ glusterd_snapshot_update_snaps_post_validate(dict_t *dict, char **op_errstr,
{
int32_t ret = -1;
int32_t missed_snap_count = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_ASSERT(op_errstr);
@@ -6522,14 +6406,12 @@ glusterd_schedule_brick_snapshot(dict_t *dict, dict_t *rsp_dict,
int32_t taskcount = 0;
char key[64] = "";
int keylen;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
struct syncargs args = {0};
snap_create_args_t *snap_args = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(snap);
@@ -6636,11 +6518,9 @@ glusterd_create_snap_object_for_clone(dict_t *dict, dict_t *rsp_dict)
char *snapname = NULL;
uuid_t *snap_id = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
-
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -6689,15 +6569,13 @@ glusterd_snapshot_clone_commit(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char *snapname = NULL;
char *volname = NULL;
char *tmp_name = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_snap_t *snap_parent = NULL;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *origin_vol = NULL;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
@@ -6834,14 +6712,12 @@ glusterd_snapshot_create_commit(dict_t *dict, char **op_errstr,
char *tmp_name = NULL;
char key[64] = "";
int keylen;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *origin_vol = NULL;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -7015,12 +6891,9 @@ snap_max_hard_limit_set_commit(dict_t *dict, uint64_t value, char *volname,
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *volinfo = NULL;
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *next_version = NULL;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
@@ -7097,7 +6970,7 @@ glusterd_snapshot_config_commit(dict_t *dict, char **op_errstr,
dict_t *rsp_dict)
{
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
glusterd_conf_t *conf = NULL;
int config_command = 0;
@@ -7108,9 +6981,6 @@ glusterd_snapshot_config_commit(dict_t *dict, char **op_errstr,
char *snap_activate = NULL;
gf_boolean_t system_conf = _gf_false;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
@@ -7241,7 +7111,7 @@ glusterd_get_brick_lvm_details(dict_t *rsp_dict,
runner_t runner = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char msg[PATH_MAX] = "";
char buf[PATH_MAX] = "";
char *ptr = NULL;
@@ -7252,8 +7122,6 @@ glusterd_get_brick_lvm_details(dict_t *rsp_dict,
GF_ASSERT(rsp_dict);
GF_ASSERT(brickinfo);
GF_ASSERT(volname);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7389,7 +7257,7 @@ glusterd_get_single_brick_status(char **op_errstr, dict_t *rsp_dict,
glusterd_brickinfo_t *brickinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char key[128] = ""; /* keyprefix is not longer than 64 bytes */
int keylen;
@@ -7399,8 +7267,6 @@ glusterd_get_single_brick_status(char **op_errstr, dict_t *rsp_dict,
char pidfile[PATH_MAX] = "";
pid_t pid = -1;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7567,7 +7433,7 @@ glusterd_get_single_snap_status(char **op_errstr, dict_t *rsp_dict,
const char *keyprefix, glusterd_snap_t *snap)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char key[64] = ""; /* keyprefix is "status.snap0" */
int keylen;
char brickkey[PATH_MAX] = "";
@@ -7577,9 +7443,6 @@ glusterd_get_single_snap_status(char **op_errstr, dict_t *rsp_dict,
int volcount = 0;
int brickcount = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
GF_ASSERT(keyprefix);
@@ -7655,10 +7518,8 @@ glusterd_get_each_snap_object_status(char **op_errstr, dict_t *rsp_dict,
char key[32] = ""; /* keyprefix is "status.snap0" */
int keylen;
char *temp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(op_errstr);
GF_ASSERT(rsp_dict);
GF_ASSERT(snap);
@@ -7747,12 +7608,10 @@ glusterd_get_snap_status_of_volume(char **op_errstr, dict_t *rsp_dict,
glusterd_volinfo_t *temp_volinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
char key[64] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int i = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7813,10 +7672,8 @@ glusterd_get_all_snapshot_status(dict_t *dict, char **op_errstr,
glusterd_conf_t *priv = NULL;
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -7859,7 +7716,7 @@ int
glusterd_snapshot_status_commit(dict_t *dict, char **op_errstr,
dict_t *rsp_dict)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
glusterd_conf_t *conf = NULL;
int32_t cmd = -1;
@@ -7867,9 +7724,6 @@ glusterd_snapshot_status_commit(dict_t *dict, char **op_errstr,
glusterd_snap_t *snap = NULL;
char *volname = NULL;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(op_errstr);
@@ -7973,7 +7827,7 @@ int32_t
glusterd_handle_snap_limit(dict_t *dict, dict_t *rsp_dict)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
uint64_t effective_max_limit = 0;
int64_t volcount = 0;
@@ -7990,8 +7844,6 @@ glusterd_handle_snap_limit(dict_t *dict, dict_t *rsp_dict)
uint64_t opt_max_hard = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
uint64_t opt_max_soft = GLUSTERD_SNAPS_DEF_SOFT_LIMIT_PERCENT;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -8099,7 +7951,7 @@ int32_t
glusterd_snapshot_clone_postvalidate(dict_t *dict, int32_t op_ret,
char **op_errstr, dict_t *rsp_dict)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int ret = -1;
int32_t cleanup = 0;
@@ -8107,9 +7959,6 @@ glusterd_snapshot_clone_postvalidate(dict_t *dict, int32_t op_ret,
glusterd_volinfo_t *snap_vol = NULL;
char *clonename = NULL;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -8178,7 +8027,7 @@ int32_t
glusterd_snapshot_create_postvalidate(dict_t *dict, int32_t op_ret,
char **op_errstr, dict_t *rsp_dict)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int ret = -1;
int32_t cleanup = 0;
@@ -8192,9 +8041,6 @@ glusterd_snapshot_create_postvalidate(dict_t *dict, int32_t op_ret,
int64_t soft_limit = 0;
int32_t snap_activate = _gf_false;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -8348,16 +8194,13 @@ int32_t
glusterd_snapshot(dict_t *dict, char **op_errstr, uint32_t *op_errno,
dict_t *rsp_dict)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int32_t snap_command = 0;
char *snap_name = NULL;
char temp[PATH_MAX] = "";
int ret = -1;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -8502,12 +8345,9 @@ glusterd_snapshot_brickop(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
int keylen;
char *volname = NULL;
int32_t snap_command = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *op_type = NULL;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -8604,12 +8444,9 @@ glusterd_snapshot_prevalidate(dict_t *dict, char **op_errstr, dict_t *rsp_dict,
uint32_t *op_errno)
{
int snap_command = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
GF_VALIDATE_OR_GOTO(this->name, op_errno, out);
@@ -8738,15 +8575,13 @@ glusterd_remove_trashpath(char *volname)
char delete_path[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
struct stat stbuf = {
0,
};
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(volname);
@@ -8805,10 +8640,6 @@ glusterd_snapshot_restore_cleanup(dict_t *rsp_dict, char *volname,
glusterd_snap_t *snap)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(rsp_dict);
GF_ASSERT(volname);
@@ -8817,7 +8648,7 @@ glusterd_snapshot_restore_cleanup(dict_t *rsp_dict, char *volname,
/* Now delete the snap entry. */
ret = glusterd_snap_remove(rsp_dict, snap, _gf_false, _gf_true, _gf_false);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_SNAP_REMOVE_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_SNAP_REMOVE_FAIL,
"Failed to delete "
"snap %s",
snap->snapname);
@@ -8827,7 +8658,7 @@ glusterd_snapshot_restore_cleanup(dict_t *rsp_dict, char *volname,
/* Delete the backup copy of volume folder */
ret = glusterd_remove_trashpath(volname);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DIR_OP_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DIR_OP_FAILED,
"Failed to remove "
"backup dir");
goto out;
@@ -8856,11 +8687,9 @@ glusterd_snapshot_revert_partial_restored_vol(glusterd_volinfo_t *volinfo)
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volinfo);
@@ -8964,11 +8793,6 @@ glusterd_snapshot_revert_restore_from_snap(glusterd_snap_t *snap)
char volname[PATH_MAX] = "";
glusterd_volinfo_t *snap_volinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(snap);
/* TODO : As of now there is only one volume in snapshot.
@@ -8981,7 +8805,7 @@ glusterd_snapshot_revert_restore_from_snap(glusterd_snap_t *snap)
ret = glusterd_volinfo_find(volname, &volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_VOL_NOT_FOUND,
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_VOL_NOT_FOUND,
"Could not get volinfo of "
"%s",
snap_volinfo->parent_volname);
@@ -8990,7 +8814,7 @@ glusterd_snapshot_revert_restore_from_snap(glusterd_snap_t *snap)
ret = glusterd_snapshot_revert_partial_restored_vol(volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_RESTORE_REVERT_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_RESTORE_REVERT_FAIL,
"Failed to revert snapshot "
"restore operation for %s volume",
volname);
@@ -9021,11 +8845,8 @@ glusterd_snapshot_restore_postop(dict_t *dict, int32_t op_ret, char **op_errstr,
int cleanup = 0;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -9143,12 +8964,9 @@ glusterd_snapshot_postvalidate(dict_t *dict, int32_t op_ret, char **op_errstr,
dict_t *rsp_dict)
{
int snap_command = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
@@ -9302,13 +9120,11 @@ glusterd_handle_snapshot_fn(rpcsvc_request_t *req)
glusterd_conf_t *conf = NULL;
char *host_uuid = NULL;
char err_str[2048] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uint32_t op_errno = 0;
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -9545,10 +9361,8 @@ glusterd_update_missed_snap_entry(glusterd_missed_snap_info *missed_snapinfo,
int32_t ret = -1;
glusterd_snap_op_t *snap_opinfo = NULL;
gf_boolean_t match = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(missed_snapinfo);
GF_ASSERT(missed_snap_op);
@@ -9632,10 +9446,8 @@ glusterd_add_new_entry_to_list(char *missed_info, char *snap_vol_id,
glusterd_conf_t *priv = NULL;
gf_boolean_t match = _gf_false;
gf_boolean_t free_missed_snap_info = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(missed_info);
GF_ASSERT(snap_vol_id);
GF_ASSERT(brick_path);
@@ -9761,10 +9573,8 @@ glusterd_add_missed_snaps_to_list(dict_t *dict, int32_t missed_snap_count)
int32_t snap_op = -1;
int32_t snap_status = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
priv = this->private;
@@ -9855,14 +9665,12 @@ gd_restore_snap_volume(dict_t *dict, dict_t *rsp_dict,
int ret = -1;
glusterd_volinfo_t *new_volinfo = NULL;
glusterd_snap_t *snap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *temp_volinfo = NULL;
glusterd_volinfo_t *voliter = NULL;
gf_boolean_t conf_present = _gf_false;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(rsp_dict);
conf = this->private;
@@ -10002,11 +9810,9 @@ glusterd_snapshot_get_volnames_uuids(dict_t *dict, char *volname,
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int op_errno = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volname);
GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, dict, out, op_errno, EINVAL);
GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, volname, out, op_errno, EINVAL);
diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c
index 225d10cc54..c73eb529d0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-statedump.c
+++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c
@@ -172,8 +172,6 @@ glusterd_dump_priv(xlator_t *this)
int port = 0;
struct pmap_registry *pmap = NULL;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
if (!priv)
return 0;
@@ -238,6 +236,5 @@ glusterd_dump_priv(xlator_t *this)
}
pthread_mutex_unlock(&priv->mutex);
-out:
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index f8e1cca1d6..7642f92903 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -176,19 +176,15 @@ glusterd_store_is_valid_brickpath(char *volname, char *brick)
glusterd_volinfo_t *volinfo = NULL;
int32_t ret = 0;
size_t volname_len = strlen(volname);
- xlator_t *this = NULL;
int bpath_len = 0;
const char delim[2] = "/";
char *sub_dir = NULL;
char *saveptr = NULL;
char *brickpath_ptr = NULL;
- this = THIS;
- GF_ASSERT(this);
-
ret = glusterd_brickinfo_new_from_brick(brick, &brickinfo, _gf_false, NULL);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_BRICK_CREATION_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_BRICK_CREATION_FAIL,
"Failed to create brick "
"info for brick %s",
brick);
@@ -197,13 +193,13 @@ glusterd_store_is_valid_brickpath(char *volname, char *brick)
}
ret = glusterd_volinfo_new(&volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create volinfo");
ret = 0;
goto out;
}
if (volname_len >= sizeof(volinfo->volname)) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NAME_TOO_LONG,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_NAME_TOO_LONG,
"volume name too long");
ret = 0;
goto out;
@@ -322,13 +318,11 @@ static int
gd_store_brick_snap_details_write(int fd, glusterd_brickinfo_t *brickinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char value[5 * PATH_MAX];
uint total_len = 0;
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -462,14 +456,11 @@ glusterd_store_snapd_write(int fd, glusterd_volinfo_t *volinfo)
0,
};
int32_t ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
GF_ASSERT(fd > 0);
- this = THIS;
- GF_ASSERT(this);
-
snprintf(value, sizeof(value), "%d", volinfo->snapd.port);
ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_SNAPD_PORT, value);
if (ret)
@@ -511,13 +502,10 @@ glusterd_store_perform_snapd_store(glusterd_volinfo_t *volinfo)
{
int fd = -1;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
- this = THIS;
- GF_ASSERT(this);
-
fd = gf_store_mkstemp(volinfo->snapd.handle);
if (fd <= 0) {
gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
@@ -542,7 +530,7 @@ glusterd_store_perform_snapd_store(glusterd_volinfo_t *volinfo)
out:
if (ret && (fd > 0))
gf_store_unlink_tmppath(volinfo->snapd.handle);
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -575,13 +563,10 @@ int32_t
glusterd_store_snapd_info(glusterd_volinfo_t *volinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(volinfo);
- this = THIS;
- GF_ASSERT(this);
-
ret = glusterd_store_create_snapd_shandle_on_absence(volinfo);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_STORE_HANDLE_CREATE_FAIL,
@@ -616,10 +601,8 @@ glusterd_store_delete_brick(glusterd_brickinfo_t *brickinfo, char *delete_path)
};
char *ptr = NULL;
char *tmppath = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickinfo);
priv = this->private;
@@ -667,10 +650,7 @@ _storeopts(dict_t *dict_value, char *key, data_t *value, void *data)
int32_t option_len = 0;
gf_store_handle_t *shandle = NULL;
glusterd_volinfo_data_store_t *dict_data = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
dict_data = (glusterd_volinfo_data_store_t *)data;
shandle = dict_data->shandle;
@@ -738,14 +718,12 @@ static int
glusterd_volume_write_snap_details(int fd, glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char buf[PATH_MAX] = {
0,
};
- this = THIS;
- GF_ASSERT(this != NULL);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, (conf != NULL), out);
@@ -793,7 +771,6 @@ glusterd_volume_exclude_options_write(int fd, glusterd_volinfo_t *volinfo)
xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- GF_ASSERT(this);
GF_ASSERT(fd > 0);
GF_ASSERT(volinfo);
conf = this->private;
@@ -1007,12 +984,9 @@ glusterd_store_volinfo_write(int fd, glusterd_volinfo_t *volinfo)
GF_ASSERT(fd > 0);
GF_ASSERT(volinfo);
GF_ASSERT(volinfo->shandle);
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_data_store_t *dict_data = NULL;
- this = THIS;
- GF_ASSERT(this);
-
shandle = volinfo->shandle;
dict_data = GF_CALLOC(1, sizeof(glusterd_volinfo_data_store_t),
@@ -1226,10 +1200,7 @@ glusterd_store_create_missed_snaps_list_shandle_on_absence()
char missed_snaps_list[PATH_MAX] = "";
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -1297,10 +1268,7 @@ glusterd_store_node_state_write(int fd, glusterd_volinfo_t *volinfo)
uint total_len = 0;
glusterd_volinfo_data_store_t *dict_data = NULL;
gf_store_handle_t shandle;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(fd > 0);
GF_ASSERT(volinfo);
@@ -1602,10 +1570,8 @@ glusterd_store_volinfo(glusterd_volinfo_t *volinfo,
{
int32_t ret = -1;
glusterfs_ctx_t *ctx = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
ctx = this->ctx;
GF_ASSERT(ctx);
GF_ASSERT(volinfo);
@@ -1654,7 +1620,7 @@ unlock:
if (ret)
glusterd_store_volume_cleanup_tmp(volinfo);
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1673,13 +1639,10 @@ glusterd_store_delete_volume(glusterd_volinfo_t *volinfo)
char trashdir[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t rename_fail = _gf_false;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(volinfo);
priv = this->private;
@@ -1763,11 +1726,10 @@ glusterd_store_delete_snap(glusterd_snap_t *snap)
struct stat st = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t rename_fail = _gf_false;
int32_t len = 0;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -2202,13 +2164,12 @@ glusterd_retrieve_uuid()
int32_t ret = -1;
gf_store_handle_t *handle = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char path[PATH_MAX] = {
0,
};
int32_t len = 0;
- this = THIS;
priv = this->private;
if (!priv->handle) {
@@ -2259,15 +2220,13 @@ glusterd_store_retrieve_snapd(glusterd_volinfo_t *volinfo)
char path[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_store_iter_t *iter = NULL;
gf_store_op_errno_t op_errno = GD_STORE_SUCCESS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
- conf = THIS->private;
+ conf = this->private;
GF_ASSERT(volinfo);
if (conf->op_version < GD_OP_VERSION_3_6_0) {
@@ -2374,7 +2333,7 @@ glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo)
char *tmpvalue = NULL;
char abspath[PATH_MAX] = {0};
struct pmap_registry *pmap = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int brickid = 0;
/* ta_brick_id initialization with 2 since ta-brick id starts with
* volname-ta-2
@@ -2386,7 +2345,6 @@ glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo)
GF_ASSERT(volinfo);
GF_ASSERT(volinfo->volname);
- this = THIS;
priv = this->private;
GLUSTERD_GET_BRICK_DIR(brickdir, volinfo, priv);
@@ -2888,11 +2846,9 @@ glusterd_store_retrieve_node_state(glusterd_volinfo_t *volinfo)
};
gf_store_op_errno_t op_errno = GD_STORE_SUCCESS;
dict_t *tmp_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volinfo);
@@ -3049,15 +3005,13 @@ glusterd_store_update_volinfo(glusterd_volinfo_t *volinfo)
char path[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_store_iter_t *iter = NULL;
gf_store_op_errno_t op_errno = GD_STORE_SUCCESS;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
- conf = THIS->private;
+ conf = this->private;
GF_ASSERT(volinfo);
GLUSTERD_GET_VOLUME_DIR(volpath, volinfo, conf);
@@ -3300,10 +3254,8 @@ glusterd_store_retrieve_volume(char *volname, glusterd_snap_t *snap)
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *origin_volinfo = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(volname);
@@ -3511,7 +3463,6 @@ glusterd_store_retrieve_volumes(xlator_t *this, glusterd_snap_t *snap)
};
int32_t len = 0;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -3596,10 +3547,8 @@ glusterd_find_brick_mount_path(char *brick_path, char **brick_mount_path)
{
char *ptr = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick_path);
GF_ASSERT(brick_mount_path);
@@ -3662,11 +3611,9 @@ glusterd_mount_brick_paths(char *brick_mount_path,
0,
};
struct mntent *entry = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick_mount_path);
GF_ASSERT(brickinfo);
@@ -3723,7 +3670,6 @@ glusterd_recreate_vol_brick_mounts(xlator_t *this, glusterd_volinfo_t *volinfo)
};
char abspath[PATH_MAX] = {0};
- GF_ASSERT(this);
GF_ASSERT(volinfo);
cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
@@ -3815,7 +3761,6 @@ glusterd_resolve_snap_bricks(xlator_t *this, glusterd_snap_t *snap)
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, snap, out);
cds_list_for_each_entry(volinfo, &snap->volumes, vol_list)
@@ -3854,13 +3799,12 @@ glusterd_store_update_snap(glusterd_snap_t *snap)
char path[PATH_MAX] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_store_iter_t *iter = NULL;
gf_store_op_errno_t op_errno = GD_STORE_SUCCESS;
int32_t len = 0;
- this = THIS;
conf = this->private;
GF_ASSERT(snap);
@@ -3947,9 +3891,8 @@ glusterd_store_retrieve_snap(char *snapname)
int32_t ret = -1;
glusterd_snap_t *snap = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(snapname);
@@ -4012,7 +3955,6 @@ glusterd_store_retrieve_missed_snaps_list(xlator_t *this)
glusterd_conf_t *priv = NULL;
gf_store_op_errno_t store_errno = GD_STORE_SUCCESS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4104,7 +4046,6 @@ glusterd_store_retrieve_snaps(xlator_t *this)
};
int32_t len = 0;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4166,10 +4107,7 @@ glusterd_store_write_missed_snapinfo(int32_t fd)
glusterd_conf_t *priv = NULL;
glusterd_missed_snap_info *missed_snapinfo = NULL;
glusterd_snap_op_t *snap_opinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -4211,10 +4149,7 @@ glusterd_store_update_missed_snaps()
int32_t fd = -1;
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
GF_ASSERT(priv);
@@ -4268,7 +4203,7 @@ glusterd_store_delete_peerinfo(glusterd_peerinfo_t *peerinfo)
{
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char peerdir[PATH_MAX] = {
0,
};
@@ -4285,7 +4220,6 @@ glusterd_store_delete_peerinfo(glusterd_peerinfo_t *peerinfo)
goto out;
}
- this = THIS;
priv = this->private;
len = snprintf(peerdir, PATH_MAX, "%s/peers", priv->workdir);
@@ -4331,7 +4265,7 @@ out:
gf_store_handle_destroy(peerinfo->shandle);
peerinfo->shandle = NULL;
}
- gf_msg_debug((this ? this->name : "glusterd"), 0, "Returning with %d", ret);
+ gf_msg_debug(this->name, 0, "Returning with %d", ret);
return ret;
}
@@ -4564,7 +4498,6 @@ glusterd_store_retrieve_peers(xlator_t *this)
gf_boolean_t is_ok;
int32_t len;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4721,7 +4654,6 @@ glusterd_recreate_all_snap_brick_mounts(xlator_t *this)
glusterd_volinfo_t *volinfo = NULL;
glusterd_snap_t *snap = NULL;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4790,7 +4722,6 @@ glusterd_snap_cleanup(xlator_t *this)
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4842,7 +4773,6 @@ glusterd_resolve_all_bricks(xlator_t *this)
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_snap_t *snap = NULL;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4888,9 +4818,7 @@ int32_t
glusterd_restore()
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
ret = glusterd_options_init(this);
if (ret < 0)
@@ -4954,13 +4882,11 @@ glusterd_store_retrieve_quota_version(glusterd_volinfo_t *volinfo)
};
char *version_str = NULL;
char *tmp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
gf_store_handle_t *handle = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -5007,7 +4933,7 @@ glusterd_store_save_quota_version_and_cksum(glusterd_volinfo_t *volinfo)
{
gf_store_handle_t *shandle = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char path[PATH_MAX] = {0};
char cksum_path[PATH_MAX + 32] = {
0,
@@ -5017,7 +4943,6 @@ glusterd_store_save_quota_version_and_cksum(glusterd_volinfo_t *volinfo)
int32_t ret = -1;
int32_t len = 0;
- this = THIS;
conf = this->private;
GLUSTERD_GET_VOLUME_DIR(path, volinfo, conf);
@@ -5067,12 +4992,9 @@ glusterd_quota_conf_write_header(int fd)
{
int header_len = 0;
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("quota", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -5104,12 +5026,9 @@ int32_t
glusterd_quota_conf_write_gfid(int fd, void *buf, char type)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("quota", this, out);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index ee6d8a464c..fbd8039d14 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -35,8 +35,6 @@ glusterd_svcs_reconfigure(glusterd_volinfo_t *volinfo)
glusterd_conf_t *conf = NULL;
char *svc_name = NULL;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -78,13 +76,9 @@ int
glusterd_svcs_stop(glusterd_volinfo_t *volinfo)
{
int ret = 0;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
#ifdef BUILD_GNFS
@@ -116,12 +110,9 @@ int
glusterd_svcs_manager(glusterd_volinfo_t *volinfo)
{
int ret = 0;
- xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- GF_ASSERT(this);
-
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
if (volinfo && volinfo->is_snap_volume)
@@ -174,14 +165,11 @@ glusterd_svc_check_volfile_identical(char *svc_name,
};
char *tmpvol = NULL;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
int need_unlink = 0;
int tmp_fd = -1;
- this = THIS;
-
- GF_ASSERT(this);
GF_ASSERT(identical);
conf = this->private;
@@ -239,7 +227,7 @@ glusterd_svc_check_topology_identical(char *svc_name,
int tmpclean = 0;
int tmpfd = -1;
- if ((!identical) || (!this) || (!this->private)) {
+ if ((!identical) || (!this->private)) {
gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -295,14 +283,11 @@ glusterd_volume_svc_check_volfile_identical(
0,
};
char *tmpvol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
int need_unlink = 0;
int tmp_fd = -1;
- this = THIS;
-
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
GF_VALIDATE_OR_GOTO(this->name, identical, out);
/* This builds volfile for volume level dameons */
@@ -360,8 +345,8 @@ glusterd_volume_svc_check_topology_identical(
int tmpclean = 0;
int tmpfd = -1;
- if ((!identical) || (!this) || (!this->private)) {
- gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ if ((!identical) || (!this->private)) {
+ gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -663,7 +648,6 @@ glusterd_svc_attach_cbk(struct rpc_req *req, struct iovec *iov, int count,
0,
};
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private;
GF_VALIDATE_OR_GOTO("glusterd", conf, out);
GF_VALIDATE_OR_GOTO("glusterd", frame, out);
@@ -825,7 +809,7 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
}
spec_fd = open(path, O_RDONLY);
if (spec_fd < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_SVC_ATTACH_FAIL,
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_SVC_ATTACH_FAIL,
"failed to read volfile %s", path);
ret = -EIO;
goto err;
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
index 18b3fb1363..41ae5c49a6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
@@ -53,7 +53,7 @@ glusterd_svc_init_common(glusterd_svc_t *svc, char *svc_name, char *workdir,
{
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char pidfile[PATH_MAX] = {
0,
};
@@ -69,9 +69,6 @@ glusterd_svc_init_common(glusterd_svc_t *svc, char *svc_name, char *workdir,
char volfileid[256] = {0};
char *volfileserver = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -134,12 +131,7 @@ glusterd_svc_init(glusterd_svc_t *svc, char *svc_name)
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
glusterd_svc_build_rundir(svc_name, priv->rundir, rundir, sizeof(rundir));
@@ -157,7 +149,7 @@ glusterd_svc_start(glusterd_svc_t *svc, int flags, dict_t *cmdline)
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char valgrind_logfile[PATH_MAX] = {0};
char *localtime_logging = NULL;
char *log_level = NULL;
@@ -167,9 +159,6 @@ glusterd_svc_start(glusterd_svc_t *svc, int flags, dict_t *cmdline)
};
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_VALIDATE_OR_GOTO("glusterd", priv, out);
GF_VALIDATE_OR_GOTO("glusterd", svc, out);
@@ -345,10 +334,7 @@ glusterd_svc_common_rpc_notify(glusterd_conn_t *conn, rpc_clnt_event_t event)
{
int ret = 0;
glusterd_svc_t *svc = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
/* Get the parent onject i.e. svc using list_entry macro */
svc = cds_list_entry(conn, glusterd_svc_t, conn);
@@ -405,12 +391,9 @@ glusterd_muxsvc_common_rpc_notify(glusterd_svc_proc_t *mux_proc,
int ret = 0;
glusterd_svc_t *svc = NULL;
glusterd_svc_t *tmp = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t need_logging = _gf_false;
- this = THIS;
- GF_ASSERT(this);
-
if (!mux_proc) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_GET_FAIL,
"Failed to get the svc proc data");
@@ -483,7 +466,7 @@ glusterd_muxsvc_conn_init(glusterd_conn_t *conn, glusterd_svc_proc_t *mux_proc,
glusterd_svc_t *svc = NULL;
options = dict_new();
- if (!this || !options)
+ if (!options)
goto out;
svc = cds_list_entry(conn, glusterd_svc_t, conn);
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index b73d37ad08..f84b9de133 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -221,10 +221,6 @@ int
glusterd_syncop_aggr_rsp_dict(glusterd_op_t op, dict_t *aggr, dict_t *rsp)
{
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
switch (op) {
case GD_OP_CREATE_VOLUME:
@@ -232,7 +228,7 @@ glusterd_syncop_aggr_rsp_dict(glusterd_op_t op, dict_t *aggr, dict_t *rsp)
case GD_OP_START_VOLUME:
ret = glusterd_aggr_brick_mount_dirs(aggr, rsp);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0,
GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL,
"Failed to "
"aggregate brick mount dirs");
@@ -338,11 +334,8 @@ gd_syncop_mgmt_v3_lock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
- xlator_t *this = NULL;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -357,7 +350,7 @@ gd_syncop_mgmt_v3_lock_cbk_fn(struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, iov, out, op_errno, EINVAL);
+ GF_VALIDATE_OR_GOTO_WITH_ERROR(THIS->name, iov, out, op_errno, EINVAL);
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
if (ret < 0)
@@ -442,11 +435,8 @@ gd_syncop_mgmt_v3_unlock_cbk_fn(struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
- xlator_t *this = NULL;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
GF_ASSERT(myframe);
@@ -461,7 +451,7 @@ gd_syncop_mgmt_v3_unlock_cbk_fn(struct rpc_req *req, struct iovec *iov,
goto out;
}
- GF_VALIDATE_OR_GOTO_WITH_ERROR(this->name, iov, out, op_errno, EINVAL);
+ GF_VALIDATE_OR_GOTO_WITH_ERROR(THIS->name, iov, out, op_errno, EINVAL);
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
if (ret < 0)
@@ -546,12 +536,9 @@ _gd_syncop_mgmt_lock_cbk(struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
-
frame = myframe;
args = frame->local;
peerid = frame->cookie;
@@ -647,12 +634,9 @@ _gd_syncop_mgmt_unlock_cbk(struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
-
frame = myframe;
args = frame->local;
peerid = frame->cookie;
@@ -743,16 +727,13 @@ _gd_syncop_stage_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
{0},
};
struct syncargs *args = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *rsp_dict = NULL;
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
-
frame = myframe;
args = frame->local;
peerid = frame->cookie;
@@ -886,10 +867,7 @@ _gd_syncop_brick_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
};
int ret = -1;
call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
frame = myframe;
args = frame->local;
@@ -966,9 +944,7 @@ gd_syncop_mgmt_brick_op(struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,
};
gd1_mgmt_brick_op_req *req = NULL;
int ret = 0;
- xlator_t *this = NULL;
- this = THIS;
args.op_ret = -1;
args.op_errno = ENOTCONN;
@@ -997,7 +973,7 @@ gd_syncop_mgmt_brick_op(struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,
if (GD_OP_STATUS_VOLUME == op) {
ret = dict_set_int32(args.dict, "index", pnode->index);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Error setting index on brick status"
" rsp dict");
args.op_ret = -1;
@@ -1053,7 +1029,7 @@ _gd_syncop_commit_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
{0},
};
struct syncargs *args = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
dict_t *rsp_dict = NULL;
call_frame_t *frame = NULL;
int op_ret = -1;
@@ -1061,9 +1037,6 @@ _gd_syncop_commit_op_cbk(struct rpc_req *req, struct iovec *iov, int count,
int type = GF_QUOTA_OPTION_TYPE_NONE;
uuid_t *peerid = NULL;
- this = THIS;
- GF_ASSERT(this);
-
frame = myframe;
args = frame->local;
peerid = frame->cookie;
@@ -1205,13 +1178,10 @@ gd_lock_op_phase(glusterd_conf_t *conf, glusterd_op_t op, dict_t *op_ctx,
int ret = -1;
int peer_cnt = 0;
uuid_t peer_uuid = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_peerinfo_t *peerinfo = NULL;
struct syncargs args = {0};
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
ret = synctask_barrier_init((&args));
if (ret)
goto out;
@@ -1285,7 +1255,7 @@ gd_stage_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
int peer_cnt = 0;
dict_t *rsp_dict = NULL;
char *hostname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
uuid_t tmp_uuid = {0};
@@ -1293,8 +1263,6 @@ gd_stage_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
struct syncargs args = {0};
dict_t *aggr_dict = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1415,7 +1383,7 @@ gd_commit_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
int ret = -1;
char *hostname = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
uuid_t tmp_uuid = {0};
char *errstr = NULL;
@@ -1424,8 +1392,6 @@ gd_commit_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
uint32_t cmd = 0;
gf_boolean_t origin_glusterd = _gf_false;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -1562,14 +1528,11 @@ gd_unlock_op_phase(glusterd_conf_t *conf, glusterd_op_t op, int *op_ret,
uuid_t tmp_uuid = {0};
int peer_cnt = 0;
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
struct syncargs args = {0};
int32_t global = 0;
char *type = NULL;
- this = THIS;
- GF_ASSERT(this);
-
/* If the lock has not been held during this
* transaction, do not send unlock requests */
if (!is_acquired) {
@@ -1712,7 +1675,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
struct cds_list_head selected = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int brick_count = 0;
int ret = -1;
rpc_clnt_t *rpc = NULL;
@@ -1720,7 +1683,6 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
int32_t cmd = GF_OP_CMD_NONE;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
rsp_dict = dict_new();
if (!rsp_dict) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
@@ -1820,7 +1782,7 @@ gd_sync_task_begin(dict_t *op_ctx, rpcsvc_request_t *req)
char *tmp = NULL;
char *global = NULL;
char *volname = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t is_acquired = _gf_false;
gf_boolean_t is_global = _gf_false;
uuid_t *txn_id = NULL;
@@ -1831,8 +1793,6 @@ gd_sync_task_begin(dict_t *op_ctx, rpcsvc_request_t *req)
gf_boolean_t cluster_lock = _gf_false;
uint32_t timeout = 0;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
index 035795b3de..cc1f174a0d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
@@ -100,14 +100,11 @@ glusterd_svc_check_tier_volfile_identical(char *svc_name,
0,
};
char *tmpvol = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
int need_unlink = 0;
int tmp_fd = -1;
- this = THIS;
-
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
GF_VALIDATE_OR_GOTO(this->name, identical, out);
glusterd_svc_build_tierd_volfile_path(volinfo, orgvol, sizeof(orgvol));
@@ -165,7 +162,7 @@ glusterd_svc_check_tier_topology_identical(char *svc_name,
int tmpclean = 0;
int tmpfd = -1;
- if ((!identical) || (!this) || (!this->private))
+ if ((!identical) || (!this->private))
goto out;
conf = this->private;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index a3ae6d6305..b14dba040b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -126,12 +126,9 @@ is_brick_mx_enabled(void)
char *value = NULL;
int ret = 0;
gf_boolean_t enabled = _gf_false;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
-
- priv = this->private;
+ priv = THIS->private;
ret = dict_get_strn(priv->opts, GLUSTERD_BRICK_MULTIPLEX_KEY,
SLEN(GLUSTERD_BRICK_MULTIPLEX_KEY), &value);
@@ -215,13 +212,12 @@ out:
gf_boolean_t
glusterd_gf_is_local_addr(char *hostname)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_hostname_t *hostname_obj = NULL;
gf_boolean_t found = _gf_false;
int ret = 1;
- this = THIS;
priv = this->private;
if (gd_has_local_address(priv, hostname)) {
@@ -249,12 +245,9 @@ get_mux_limit_per_process(int *mux_limit)
char *value = NULL;
int ret = -1;
int max_bricks_per_proc = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -288,12 +281,9 @@ get_gd_vol_thread_limit(int *thread_limit)
char *value = NULL;
int ret = -1;
int vol_per_thread_limit = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -335,11 +325,10 @@ _brick_for_each(glusterd_volinfo_t *volinfo, dict_t *mod_dict, void *data,
{
int ret = 0;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = THIS;
cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
{
- gf_msg_debug(this->name, 0, "Found a brick - %s:%s",
+ gf_msg_debug(THIS->name, 0, "Found a brick - %s:%s",
brickinfo->hostname, brickinfo->path);
ret = fn(volinfo, brickinfo, mod_dict, data);
if (ret)
@@ -433,10 +422,7 @@ glusterd_lock(uuid_t uuid)
char new_owner_str[50] = "";
char owner_str[50] = "";
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(uuid);
@@ -470,17 +456,13 @@ glusterd_unlock(uuid_t uuid)
char new_owner_str[50] = "";
char owner_str[50] = "";
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(uuid);
glusterd_get_lock_owner(&owner);
if (gf_uuid_is_null(owner)) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_LOCK_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_LOCK_FAIL,
"Cluster lock not held!");
goto out;
}
@@ -488,7 +470,7 @@ glusterd_unlock(uuid_t uuid)
ret = gf_uuid_compare(uuid, owner);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_LOCK_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_LOCK_FAIL,
"Cluster lock held by %s ,"
"unlock req from %s!",
uuid_utoa_r(owner, owner_str), uuid_utoa_r(uuid, new_owner_str));
@@ -498,7 +480,7 @@ glusterd_unlock(uuid_t uuid)
ret = glusterd_unset_lock_owner(uuid);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_UNLOCK_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_UNLOCK_FAIL,
"Unable to clear cluster "
"lock");
goto out;
@@ -513,12 +495,6 @@ out:
int
glusterd_get_uuid(uuid_t *uuid)
{
- glusterd_conf_t *priv = NULL;
-
- priv = THIS->private;
-
- GF_ASSERT(priv);
-
gf_uuid_copy(*uuid, MY_UUID);
return 0;
@@ -540,7 +516,6 @@ glusterd_submit_request(struct rpc_clnt *rpc, void *req, call_frame_t *frame,
};
GF_ASSERT(rpc);
- GF_ASSERT(this);
if (req) {
req_size = xdr_sizeof(xdrproc, req);
@@ -816,11 +791,9 @@ glusterd_volinfo_dup(glusterd_volinfo_t *volinfo,
gf_boolean_t set_userauth)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *new_volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, dup_volinfo, out);
@@ -880,10 +853,7 @@ glusterd_brickinfo_dup(glusterd_brickinfo_t *brickinfo,
glusterd_brickinfo_t *dup_brickinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_VALIDATE_OR_GOTO(this->name, brickinfo, out);
GF_VALIDATE_OR_GOTO(this->name, dup_brickinfo, out);
@@ -896,7 +866,7 @@ glusterd_brickinfo_dup(glusterd_brickinfo_t *brickinfo,
strcpy(dup_brickinfo->mnt_opts, brickinfo->mnt_opts);
ret = gf_canonicalize_path(dup_brickinfo->path);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_CANONICALIZE_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CANONICALIZE_FAIL,
"Failed to canonicalize "
"brick path");
goto out;
@@ -1166,10 +1136,6 @@ int32_t
glusterd_resolve_brick(glusterd_brickinfo_t *brickinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickinfo);
if (!gf_uuid_compare(brickinfo->uuid, MY_UUID) ||
@@ -1181,7 +1147,7 @@ glusterd_resolve_brick(glusterd_brickinfo_t *brickinfo)
ret = glusterd_hostname_to_uuid(brickinfo->hostname, brickinfo->uuid);
out:
- gf_msg_debug(this->name, 0, "Returning %d", ret);
+ gf_msg_debug(THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -1194,10 +1160,8 @@ glusterd_get_brick_mount_dir(char *brickpath, char *hostname, char *mount_dir)
uuid_t brick_uuid = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brickpath);
GF_ASSERT(hostname);
GF_ASSERT(mount_dir);
@@ -1252,11 +1216,9 @@ glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo,
char *tmp_path = NULL;
int32_t ret = -1;
glusterd_brickinfo_t *new_brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char abspath[PATH_MAX] = "";
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick);
GF_ASSERT(brickinfo);
@@ -1641,9 +1603,7 @@ glusterd_volume_brickinfo_get(uuid_t uuid, char *hostname, char *path,
glusterd_brickinfo_t *brickiter = NULL;
uuid_t peer_uuid = {0};
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
if (uuid) {
gf_uuid_copy(peer_uuid, uuid);
@@ -1683,9 +1643,7 @@ glusterd_volume_ta_brickinfo_get(uuid_t uuid, char *hostname, char *path,
{
glusterd_brickinfo_t *ta_brickiter = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
ret = -1;
@@ -1753,7 +1711,7 @@ glusterd_volinfo_find_by_volume_id(uuid_t volume_id,
glusterd_volinfo_t **volinfo)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *voliter = NULL;
glusterd_conf_t *priv = NULL;
@@ -1762,7 +1720,6 @@ glusterd_volinfo_find_by_volume_id(uuid_t volume_id,
return -1;
}
- this = THIS;
priv = this->private;
cds_list_for_each_entry(voliter, &priv->volumes, vol_list)
@@ -1782,12 +1739,10 @@ glusterd_volinfo_find(const char *volname, glusterd_volinfo_t **volinfo)
{
glusterd_volinfo_t *tmp_volinfo = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
GF_ASSERT(volname);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1811,12 +1766,10 @@ glusterd_volume_exists(const char *volname)
{
glusterd_volinfo_t *tmp_volinfo = NULL;
gf_boolean_t volume_found = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
GF_ASSERT(volname);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1839,10 +1792,8 @@ glusterd_service_stop(const char *service, char *pidfile, int sig,
{
int32_t ret = -1;
pid_t pid = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
if (!gf_is_service_running(pidfile, &pid)) {
ret = 0;
gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_ALREADY_STOPPED,
@@ -1894,12 +1845,9 @@ glusterd_service_stop_nolock(const char *service, char *pidfile, int sig,
{
int32_t ret = -1;
pid_t pid = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
FILE *file = NULL;
- this = THIS;
- GF_ASSERT(this);
-
file = fopen(pidfile, "r+");
if (file) {
ret = fscanf(file, "%d", &pid);
@@ -1983,7 +1931,7 @@ glusterd_set_brick_socket_filepath(glusterd_volinfo_t *volinfo,
char *sockpath, size_t len)
{
char volume_dir[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int expected_file_len = 0;
char export_path[PATH_MAX] = "";
@@ -1993,8 +1941,6 @@ glusterd_set_brick_socket_filepath(glusterd_volinfo_t *volinfo,
expected_file_len = SLEN(GLUSTERD_SOCK_DIR) + SLEN("/") +
SHA256_DIGEST_LENGTH * 2 + SLEN(".socket") + 1;
GF_ASSERT(len >= expected_file_len);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
@@ -2068,10 +2014,9 @@ _mk_rundir_p(glusterd_volinfo_t *volinfo)
{
char rundir[PATH_MAX] = "";
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
priv = this->private;
GLUSTERD_GET_VOLUME_PID_DIR(rundir, volinfo, priv);
ret = mkdir_p(rundir, 0755, _gf_true);
@@ -2087,7 +2032,7 @@ glusterd_volume_start_glusterfs(glusterd_volinfo_t *volinfo,
gf_boolean_t wait)
{
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char pidfile[PATH_MAX + 1] = "";
char volfile[PATH_MAX] = "";
@@ -2116,9 +2061,6 @@ glusterd_volume_start_glusterfs(glusterd_volinfo_t *volinfo,
GF_ASSERT(volinfo);
GF_ASSERT(brickinfo);
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -2396,15 +2338,12 @@ glusterd_brick_unlink_socket_file(glusterd_volinfo_t *volinfo,
{
char path[PATH_MAX] = "";
char socketpath[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
GF_ASSERT(volinfo);
GF_ASSERT(brickinfo);
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GLUSTERD_GET_VOLUME_DIR(path, volinfo, priv);
glusterd_set_brick_socket_filepath(volinfo, brickinfo, socketpath,
@@ -2513,13 +2452,10 @@ glusterd_brick_process_remove_brick(glusterd_brickinfo_t *brickinfo,
int *last_brick)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_brick_proc_t *brick_proc = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
GF_VALIDATE_OR_GOTO(this->name, brickinfo, out);
@@ -2560,13 +2496,10 @@ glusterd_brick_process_add_brick(glusterd_brickinfo_t *brickinfo,
glusterd_brickinfo_t *parent_brickinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_brick_proc_t *brick_proc = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
GF_VALIDATE_OR_GOTO(this->name, brickinfo, out);
@@ -2605,13 +2538,10 @@ int
glusterd_brick_proc_for_port(int port, glusterd_brick_proc_t **brickprocess)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_brick_proc_t *brick_proc = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -2632,7 +2562,7 @@ glusterd_volume_stop_glusterfs(glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo,
gf_boolean_t del_brick)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = -1;
char *op_errstr = NULL;
@@ -2643,9 +2573,6 @@ glusterd_volume_stop_glusterfs(glusterd_volinfo_t *volinfo,
GF_ASSERT(volinfo);
GF_ASSERT(brickinfo);
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -2852,7 +2779,6 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
char buf[32];
gf_boolean_t unlink_sortfile = _gf_false;
glusterd_conf_t *priv = THIS->private;
- xlator_t *this = THIS;
mode_t orig_umask = 0;
GF_ASSERT(volinfo);
@@ -2860,7 +2786,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
fd = open(cksum_path, O_RDWR | O_APPEND | O_CREAT | O_TRUNC, 0600);
if (-1 == fd) {
- gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
"Unable to open %s,"
" errno: %d",
cksum_path, errno);
@@ -2876,7 +2802,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
sort_fd = mkstemp(sort_filepath);
umask(orig_umask);
if (-1 == sort_fd) {
- gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
"Could not generate "
"temp file, reason: %s for volume: %s",
strerror(errno), volinfo->volname);
@@ -2889,7 +2815,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
ret = glusterd_sort_and_redirect(filepath, sort_fd);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_OP_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_FILE_OP_FAILED,
"sorting info file "
"failed");
goto out;
@@ -2901,7 +2827,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
ret = get_checksum_for_path(sort_filepath, &cksum, priv->op_version);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
"unable to get "
"checksum for path: %s",
sort_filepath);
@@ -2917,7 +2843,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
} else if (priv->op_version < GD_OP_VERSION_7_0) {
ret = get_checksum_for_path(filepath, &cksum, priv->op_version);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
"unable to get "
"checksum for path: %s",
filepath);
@@ -2927,7 +2853,7 @@ glusterd_volume_compute_cksum(glusterd_volinfo_t *volinfo, char *cksum_path,
ret = get_checksum_for_file(fd, &cksum, priv->op_version);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_GET_FAIL,
"unable to get checksum for path: %s", filepath);
goto out;
}
@@ -2939,7 +2865,7 @@ out:
sys_close(fd);
if (unlink_sortfile)
sys_unlink(sort_filepath);
- gf_msg_debug(this->name, 0, "Returning with %d", ret);
+ gf_msg_debug("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -2953,13 +2879,10 @@ glusterd_compute_cksum(glusterd_volinfo_t *volinfo, gf_boolean_t is_quota_conf)
char path[PATH_MAX] = "";
char filepath[PATH_MAX] = "";
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
int32_t len1 = 0;
int32_t len2 = 0;
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
GLUSTERD_GET_VOLUME_DIR(path, volinfo, conf);
@@ -2983,7 +2906,7 @@ glusterd_compute_cksum(glusterd_volinfo_t *volinfo, gf_boolean_t is_quota_conf)
ret = glusterd_volume_compute_cksum(volinfo, cksum_path, filepath,
is_quota_conf, &cs);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_COMPUTE_FAIL,
+ gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_CKSUM_COMPUTE_FAIL,
"Failed to compute checksum "
"for volume %s",
volinfo->volname);
@@ -3082,10 +3005,8 @@ glusterd_add_volume_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict,
glusterd_dict_ctx_t ctx = {0};
char *rebalance_id_str = NULL;
char *rb_id_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(dict);
GF_ASSERT(volinfo);
GF_ASSERT(prefix);
@@ -3393,12 +3314,10 @@ glusterd_vol_add_quota_conf_to_dict(glusterd_volinfo_t *volinfo, dict_t *load,
char key_prefix[32];
int gfid_idx = 0;
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char type = 0;
float version = 0.0f;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(prefix);
ret = glusterd_store_create_quota_conf_sh_on_absence(volinfo);
@@ -3655,7 +3574,7 @@ glusterd_add_volumes_to_export_dict(dict_t *peer_data, char **buf,
glusterd_volinfo_t *volinfo = NULL;
int32_t count = 0;
glusterd_dict_ctx_t ctx = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int totthread = 0;
int volcnt = 0;
int start = 1;
@@ -3668,8 +3587,6 @@ glusterd_add_volumes_to_export_dict(dict_t *peer_data, char **buf,
int th_ret = 0;
int i = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -3793,15 +3710,12 @@ glusterd_compare_friend_volume(dict_t *peer_data,
uint32_t quota_version = 0;
uint32_t stage_deleted = 0;
int32_t version = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(peer_data);
GF_ASSERT(arg);
GF_ASSERT(status);
- this = THIS;
- GF_ASSERT(this);
-
snprintf(key_prefix, sizeof(key_prefix), "volume%d", count);
keylen = snprintf(key, sizeof(key), "%s.name", key_prefix);
ret = dict_get_strn(arg->peer_ver_data, key, keylen, &volname);
@@ -4338,11 +4252,9 @@ glusterd_import_quota_conf(dict_t *peer_data, int vol_idx,
uuid_t gfid = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int8_t gfid_type = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
GF_ASSERT(prefix);
@@ -4461,7 +4373,6 @@ gd_import_friend_volume_rebal_dict(dict_t *dict, int count,
GF_ASSERT(dict);
GF_ASSERT(volinfo);
xlator_t *this = THIS;
- GF_ASSERT(this);
snprintf(key_prefix, sizeof(key_prefix), "volume%d", count);
ret = snprintf(key, sizeof(key), "%s.rebal-dict-count", key_prefix);
@@ -4512,6 +4423,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
int op_version = 0;
int client_op_version = 0;
uint32_t stage_deleted = 0;
+ xlator_t *this = THIS;
GF_ASSERT(peer_data);
GF_ASSERT(volinfo);
@@ -4615,7 +4527,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
keylen = snprintf(key, sizeof(key), "%s.replica_count", key_prefix);
ret = dict_get_int32n(peer_data, key, keylen, &new_volinfo->replica_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
/* not having a 'arbiter_count' key is not a error
@@ -4623,7 +4535,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
keylen = snprintf(key, sizeof(key), "%s.arbiter_count", key_prefix);
ret = dict_get_int32n(peer_data, key, keylen, &new_volinfo->arbiter_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
/* not having a 'thin_arbiter_count' key is not a error
@@ -4632,7 +4544,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
ret = dict_get_int32n(peer_data, key, keylen,
&new_volinfo->thin_arbiter_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
/* not having a 'disperse_count' key is not a error
@@ -4640,7 +4552,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
keylen = snprintf(key, sizeof(key), "%s.disperse_count", key_prefix);
ret = dict_get_int32n(peer_data, key, keylen, &new_volinfo->disperse_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
/* not having a 'redundancy_count' key is not a error
@@ -4649,7 +4561,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
ret = dict_get_int32n(peer_data, key, keylen,
&new_volinfo->redundancy_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
/* not having a 'dist_count' key is not a error
@@ -4658,7 +4570,7 @@ glusterd_import_volinfo(dict_t *peer_data, int count,
ret = dict_get_int32n(peer_data, key, keylen,
&new_volinfo->dist_leaf_count);
if (ret)
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
"peer is possibly old version");
new_volinfo->subvol_count = new_volinfo->brick_count /
@@ -4852,13 +4764,11 @@ glusterd_volinfo_copy_brickinfo(glusterd_volinfo_t *old_volinfo,
glusterd_brickinfo_t *old_ta_brickinfo = NULL;
glusterd_conf_t *priv = NULL;
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char abspath[PATH_MAX] = "";
GF_ASSERT(new_volinfo);
GF_ASSERT(old_volinfo);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -4991,13 +4901,10 @@ glusterd_delete_stale_volume(glusterd_volinfo_t *stale_volinfo,
int32_t ret = -1;
glusterd_volinfo_t *temp_volinfo = NULL;
glusterd_volinfo_t *voliter = NULL;
- xlator_t *this = NULL;
glusterd_svc_t *svc = NULL;
GF_ASSERT(stale_volinfo);
GF_ASSERT(valid_volinfo);
- this = THIS;
- GF_ASSERT(this);
/* Copy snap_volumes list from stale_volinfo to valid_volinfo */
valid_volinfo->snap_count = 0;
@@ -5013,7 +4920,7 @@ glusterd_delete_stale_volume(glusterd_volinfo_t *stale_volinfo,
valid_volinfo->restored_from_snap))) {
ret = glusterd_lvm_snapshot_remove(NULL, stale_volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_SNAP_REMOVE_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_SNAP_REMOVE_FAIL,
"Failed to remove lvm snapshot for "
"restored volume %s",
stale_volinfo->volname);
@@ -5120,7 +5027,7 @@ glusterd_import_friend_volume(dict_t *peer_data, int count,
{
int32_t ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_t *old_volinfo = NULL;
glusterd_volinfo_t *new_volinfo = NULL;
glusterd_svc_t *svc = NULL;
@@ -5129,8 +5036,6 @@ glusterd_import_friend_volume(dict_t *peer_data, int count,
GF_ASSERT(peer_data);
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -5242,16 +5147,13 @@ glusterd_import_friend_volumes_synctask(void *opaque)
int32_t ret = -1;
int32_t count = 0;
int i = 1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
dict_t *peer_data = NULL;
glusterd_friend_synctask_args_t *arg = NULL;
uint64_t bm = 0;
uint64_t mask = 0;
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_ASSERT(conf);
@@ -5341,22 +5243,15 @@ glusterd_get_global_server_quorum_ratio(dict_t *opts, double *quorum)
{
int ret = -1;
char *quorum_str = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_strn(opts, GLUSTERD_QUORUM_RATIO_KEY,
SLEN(GLUSTERD_QUORUM_RATIO_KEY), &quorum_str);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=%s", GLUSTERD_QUORUM_RATIO_KEY, NULL);
- goto out;
+ } else {
+ ret = gf_string2percent(quorum_str, quorum);
}
-
- ret = gf_string2percent(quorum_str, quorum);
- if (ret)
- goto out;
- ret = 0;
-out:
return ret;
}
@@ -5365,22 +5260,15 @@ glusterd_get_global_opt_version(dict_t *opts, uint32_t *version)
{
int ret = -1;
char *version_str = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_strn(opts, GLUSTERD_GLOBAL_OPT_VERSION,
SLEN(GLUSTERD_GLOBAL_OPT_VERSION), &version_str);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=%s", GLUSTERD_GLOBAL_OPT_VERSION, NULL);
- goto out;
+ } else {
+ ret = gf_string2uint(version_str, version);
}
-
- ret = gf_string2uint(version_str, version);
- if (ret)
- goto out;
- ret = 0;
-out:
return ret;
}
@@ -5406,7 +5294,7 @@ out:
int32_t
glusterd_import_global_opts(dict_t *friend_data)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int ret = -1;
dict_t *import_options = NULL;
@@ -5416,7 +5304,6 @@ glusterd_import_global_opts(dict_t *friend_data)
double old_quorum = 0.0;
double new_quorum = 0.0;
- this = THIS;
conf = this->private;
ret = dict_get_int32n(friend_data, "global-opt-count",
@@ -5485,12 +5372,10 @@ glusterd_compare_friend_data(dict_t *peer_data, dict_t *cmp, int32_t *status,
int32_t count = 0;
int i = 1;
gf_boolean_t update = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_friend_synctask_args_t *arg = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(peer_data);
GF_ASSERT(status);
@@ -5719,12 +5604,9 @@ glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
glusterd_svc_t *svc = NULL;
char key[64] = "";
int keylen;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -5837,7 +5719,7 @@ glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
}
out:
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -5882,12 +5764,9 @@ gf_boolean_t
glusterd_are_all_volumes_stopped()
{
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
glusterd_volinfo_t *voliter = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
cds_list_for_each_entry(voliter, &priv->volumes, vol_list)
@@ -5903,12 +5782,9 @@ gf_boolean_t
glusterd_all_shd_compatible_volumes_stopped()
{
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
glusterd_volinfo_t *voliter = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
cds_list_for_each_entry(voliter, &priv->volumes, vol_list)
@@ -5926,12 +5802,9 @@ gf_boolean_t
glusterd_all_volumes_with_quota_stopped()
{
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
glusterd_volinfo_t *voliter = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
cds_list_for_each_entry(voliter, &priv->volumes, vol_list)
@@ -5948,13 +5821,10 @@ glusterd_all_volumes_with_quota_stopped()
gf_boolean_t
glusterd_have_volumes()
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t volumes_exist = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", (this != NULL), out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, (priv != NULL), out);
@@ -5968,13 +5838,9 @@ glusterd_volume_count_get(void)
{
glusterd_volinfo_t *tmp_volinfo = NULL;
int32_t ret = 0;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
cds_list_for_each_entry(tmp_volinfo, &priv->volumes, vol_list) { ret++; }
@@ -5988,15 +5854,10 @@ glusterd_brickinfo_get(uuid_t uuid, char *hostname, char *path,
{
glusterd_volinfo_t *volinfo = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
int ret = -1;
GF_ASSERT(path);
-
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
{
@@ -6060,7 +5921,7 @@ attach_brick_callback(struct rpc_req *req, struct iovec *iov, int count,
ret = glusterd_get_volinfo_from_brick(other_brick->path, &volinfo);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
"Failed to get volinfo"
" from brick(%s) so pidfile copying/unlink will fail",
other_brick->path);
@@ -6071,7 +5932,7 @@ attach_brick_callback(struct rpc_req *req, struct iovec *iov, int count,
ret = glusterd_get_volinfo_from_brick(brickinfo->path, &volinfo);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
"Failed to get volinfo"
" from brick(%s) so pidfile copying/unlink will fail",
brickinfo->path);
@@ -6094,10 +5955,10 @@ attach_brick_callback(struct rpc_req *req, struct iovec *iov, int count,
brickinfo->status = GF_BRICK_STARTED;
brickinfo->rpc = rpc_clnt_ref(other_brick->rpc);
- gf_log(THIS->name, GF_LOG_INFO, "brick %s is attached successfully",
+ gf_log(this->name, GF_LOG_INFO, "brick %s is attached successfully",
brickinfo->path);
} else {
- gf_log(THIS->name, GF_LOG_INFO,
+ gf_log(this->name, GF_LOG_INFO,
"attach_brick failed pidfile"
" is %s for brick_path %s",
pidfile2, brickinfo->path);
@@ -6390,27 +6251,27 @@ find_compat_brick_in_vol(glusterd_conf_t *conf,
* dictionaries and dict_foreach_match will only find that one.
*/
- gf_log(THIS->name, GF_LOG_DEBUG, "comparing options for %s and %s",
+ gf_log(this->name, GF_LOG_DEBUG, "comparing options for %s and %s",
comp_vol->volname, srch_vol->volname);
if (dict_foreach_match(comp_vol->dict, unsafe_option, NULL,
opts_mismatch, srch_vol->dict) < 0) {
- gf_log(THIS->name, GF_LOG_DEBUG, "failure forward");
+ gf_log(this->name, GF_LOG_DEBUG, "failure forward");
return NULL;
}
if (dict_foreach_match(srch_vol->dict, unsafe_option, NULL,
opts_mismatch, comp_vol->dict) < 0) {
- gf_log(THIS->name, GF_LOG_DEBUG, "failure backward");
+ gf_log(this->name, GF_LOG_DEBUG, "failure backward");
return NULL;
}
- gf_log(THIS->name, GF_LOG_DEBUG, "all options match");
+ gf_log(this->name, GF_LOG_DEBUG, "all options match");
}
ret = get_mux_limit_per_process(&mux_limit);
if (ret) {
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"Retrieving brick mux "
"limit failed. Returning NULL");
return NULL;
@@ -6431,7 +6292,7 @@ find_compat_brick_in_vol(glusterd_conf_t *conf,
ret = glusterd_brick_proc_for_port(other_brick->port, &brick_proc);
if (ret) {
- gf_msg_debug(THIS->name, 0,
+ gf_msg_debug(this->name, 0,
"Couldn't get brick "
"process corresponding to brick %s:%s",
other_brick->hostname, other_brick->path);
@@ -6446,7 +6307,7 @@ find_compat_brick_in_vol(glusterd_conf_t *conf,
* options hasn't yet been explicitly set. Continue
* as if there's no limit set
*/
- gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_NO_MUX_LIMIT,
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NO_MUX_LIMIT,
"cluster.max-bricks-per-process options isn't "
"set. Continuing with no limit set for "
"brick multiplexing.");
@@ -6585,7 +6446,7 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
{
char buf[1024] = "";
char cmdline[2048] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int fd = -1;
int i = 0, j = 0;
char *ptr = NULL;
@@ -6594,9 +6455,6 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
size_t blen = 0;
int ret = -1;
- this = THIS;
- GF_ASSERT(this);
-
#ifdef __FreeBSD__
blen = sizeof(buf);
int mib[4];
@@ -6782,7 +6640,7 @@ glusterd_brick_start(glusterd_volinfo_t *volinfo,
gf_boolean_t only_connect)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_brickinfo_t *other_brick;
glusterd_conf_t *conf = NULL;
int32_t pid = -1;
@@ -6796,8 +6654,6 @@ glusterd_brick_start(glusterd_volinfo_t *volinfo,
};
ssize_t size = -1;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
if ((!brickinfo) || (!volinfo)) {
@@ -7029,15 +6885,12 @@ glusterd_restart_bricks(void *opaque)
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_snap_t *snap = NULL;
gf_boolean_t start_svcs = _gf_false;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int active_count = 0;
int quorum_count = 0;
gf_boolean_t node_quorum = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, return_block);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, return_block);
@@ -7194,10 +7047,8 @@ _local_gsyncd_start(dict_t *this, char *key, data_t *value, void *data)
gf_boolean_t is_template_in_use = _gf_false;
gf_boolean_t is_paused = _gf_false;
char key1[1024] = "";
- xlator_t *this1 = NULL;
+ xlator_t *this1 = THIS;
- this1 = THIS;
- GF_ASSERT(this1);
priv = this1->private;
GF_ASSERT(priv);
GF_ASSERT(data);
@@ -7393,7 +7244,6 @@ glusterd_get_brickinfo(xlator_t *this, const char *brickname, int port,
int ret = -1;
GF_ASSERT(brickname);
- GF_ASSERT(this);
priv = this->private;
cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
@@ -7500,7 +7350,6 @@ glusterd_get_brick_root(char *path, char **mount_point)
struct stat brickstat = {0};
struct stat buf = {0};
xlator_t *this = THIS;
- GF_ASSERT(this);
if (!path) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
@@ -7597,7 +7446,6 @@ glusterd_add_inode_size_to_dict(dict_t *dict, int count)
struct fs_info *fs = NULL;
static dict_t *cached_fs = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
ret = snprintf(key, sizeof(key), "brick%d.device", count);
ret = dict_get_strn(dict, key, ret, &device);
@@ -7767,7 +7615,6 @@ glusterd_add_brick_mount_details(glusterd_brickinfo_t *brickinfo, dict_t *dict,
char *mnt_pt = NULL;
struct mntent *entry = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
snprintf(base_key, sizeof(base_key), "brick%d", count);
@@ -7830,15 +7677,12 @@ glusterd_get_brick_mount_device(char *brick_path)
struct mntent save_entry = {
0,
};
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick_path);
ret = glusterd_get_brick_root(brick_path, &mnt_pt);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BRICKPATH_ROOT_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_BRICKPATH_ROOT_GET_FAIL,
"Failed to get mount point "
"for %s brick",
brick_path);
@@ -7848,7 +7692,7 @@ glusterd_get_brick_mount_device(char *brick_path)
entry = glusterd_get_mnt_entry_info(mnt_pt, buff, sizeof(buff),
&save_entry);
if (NULL == entry) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_MNTENTRY_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_MNTENTRY_GET_FAIL,
"Failed to get mnt entry "
"for %s mount path",
mnt_pt);
@@ -7879,9 +7723,8 @@ glusterd_add_brick_detail_to_dict(glusterd_volinfo_t *volinfo,
char key[64];
char base_key[32];
struct statvfs brickstat = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
GF_ASSERT(volinfo);
GF_ASSERT(brickinfo);
GF_ASSERT(dict);
@@ -7976,7 +7819,7 @@ glusterd_add_brick_to_dict(glusterd_volinfo_t *volinfo,
int keylen;
char base_key[32];
char pidfile[PATH_MAX] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
gf_boolean_t brick_online = _gf_false;
char *brickpath = NULL;
@@ -7985,9 +7828,6 @@ glusterd_add_brick_to_dict(glusterd_volinfo_t *volinfo,
GF_ASSERT(brickinfo);
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
snprintf(base_key, sizeof(base_key), "brick%d", count);
@@ -8109,10 +7949,8 @@ glusterd_all_volume_cond_check(glusterd_condition_func func, int status,
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
int ret = -1;
- xlator_t *this = NULL;
- this = THIS;
- priv = this->private;
+ priv = THIS->private;
cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
{
@@ -8136,11 +7974,9 @@ glusterd_brick_stop(glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo, gf_boolean_t del_brick)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -8197,10 +8033,8 @@ glusterd_new_brick_validate(char *brick, glusterd_brickinfo_t *brickinfo,
gf_boolean_t is_allocated = _gf_false;
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -8440,7 +8274,6 @@ glusterd_check_and_set_brick_xattr(char *host, char *path, uuid_t uuid,
gf_boolean_t in_use = _gf_false;
int flags = 0;
xlator_t *this = THIS;
- GF_ASSERT(this);
/* Check for xattr support in backend fs */
ret = sys_lsetxattr(path, "trusted.glusterfs.test", "working", 8, 0);
@@ -8629,10 +8462,7 @@ glusterd_sm_tr_log_transition_add(glusterd_sm_tr_log_t *log, int old_state,
glusterd_sm_transition_t *transitions = NULL;
int ret = -1;
int next = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GF_ASSERT(log);
if (!log)
@@ -8848,14 +8678,11 @@ glusterd_start_gsync(glusterd_volinfo_t *primary_vol, char *secondary,
runner_t runner = {
0,
};
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
int errcode = 0;
gf_boolean_t is_template_in_use = _gf_false;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
uuid_utoa_r(MY_UUID, uuid_str);
@@ -9041,13 +8868,9 @@ glusterd_set_dump_options(char *dumpoptions_path, char *options, int option_cnt)
char *tmpptr = NULL;
FILE *fp = NULL;
int nfs_cnt = 0;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
if (0 == option_cnt || (option_cnt == 1 && (!strcmp(options, "nfs ")))) {
@@ -9096,16 +8919,13 @@ glusterd_brick_signal(glusterd_volinfo_t *volinfo,
int option_cnt, char **op_errstr, int sig)
{
int ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
char pidfile_path[PATH_MAX] = "";
char dumpoptions_path[PATH_MAX] = "";
FILE *pidfile = NULL;
pid_t pid = -1;
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
if (gf_uuid_is_null(brickinfo->uuid)) {
@@ -9198,7 +9018,6 @@ int
glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr)
{
int ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
char pidfile_path[PATH_MAX] = "";
FILE *pidfile = NULL;
@@ -9209,9 +9028,7 @@ glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr)
char *dup_options = NULL;
char msg[256] = "";
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
dup_options = gf_strdup(options);
@@ -9338,7 +9155,7 @@ int
glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char pidfile_path[PATH_MAX] = "";
FILE *pidfile = NULL;
@@ -9349,8 +9166,6 @@ glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr)
char *dup_options = NULL;
char msg[256] = "";
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -9502,7 +9317,8 @@ glusterd_friend_remove_cleanup_vols(uuid_t uuid)
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *tmp_volinfo = NULL;
- priv = THIS->private;
+ xlator_t *this = THIS;
+ priv = this->private;
GF_ASSERT(priv);
cds_list_for_each_entry_safe(volinfo, tmp_volinfo, &priv->volumes, vol_list)
@@ -9513,7 +9329,7 @@ glusterd_friend_remove_cleanup_vols(uuid_t uuid)
svc = &(volinfo->snapd.svc);
ret = svc->stop(svc, SIGTERM);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
"Failed "
"to stop snapd daemon service");
}
@@ -9527,7 +9343,7 @@ glusterd_friend_remove_cleanup_vols(uuid_t uuid)
svc = &(volinfo->shd.svc);
ret = svc->stop(svc, SIGTERM);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
"Failed "
"to stop shd daemon service");
}
@@ -9535,11 +9351,11 @@ glusterd_friend_remove_cleanup_vols(uuid_t uuid)
}
if (glusterd_friend_contains_vol_bricks(volinfo, uuid) == 2) {
- gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_STALE_VOL_DELETE_INFO,
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_STALE_VOL_DELETE_INFO,
"Deleting stale volume %s", volinfo->volname);
ret = glusterd_delete_volume(volinfo);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0,
+ gf_msg(this->name, GF_LOG_ERROR, 0,
GD_MSG_STALE_VOL_REMOVE_FAIL,
"Error deleting stale volume");
goto out;
@@ -9550,12 +9366,12 @@ glusterd_friend_remove_cleanup_vols(uuid_t uuid)
/* Reconfigure all daemon services upon peer detach */
ret = glusterd_svcs_reconfigure(NULL);
if (ret) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_STOP_FAIL,
"Failed to reconfigure all daemon services.");
}
ret = 0;
out:
- gf_msg_debug(THIS->name, 0, "Returning %d", ret);
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
@@ -9586,8 +9402,8 @@ glusterd_get_client_filepath(char *filepath, glusterd_volinfo_t *volinfo,
{
int ret = 0;
char path[PATH_MAX] = "";
- glusterd_conf_t *priv = NULL;
int32_t len = 0;
+ glusterd_conf_t *priv = NULL;
priv = THIS->private;
@@ -9621,8 +9437,8 @@ glusterd_get_trusted_client_filepath(char *filepath,
{
int ret = 0;
char path[PATH_MAX] = "";
- glusterd_conf_t *priv = NULL;
int32_t len = 0;
+ glusterd_conf_t *priv = NULL;
priv = THIS->private;
@@ -9678,15 +9494,12 @@ int
glusterd_volume_defrag_restart(glusterd_volinfo_t *volinfo, char *op_errstr,
size_t len, int cmd, defrag_cbk_fn_t cbk)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char pidfile[PATH_MAX] = "";
int ret = -1;
pid_t pid = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
if (!priv)
return ret;
@@ -9744,12 +9557,11 @@ void
glusterd_defrag_info_set(glusterd_volinfo_t *volinfo, dict_t *dict, int cmd,
int status, int op)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
char *task_id_str = NULL;
glusterd_rebalance_t *rebal = NULL;
- this = THIS;
rebal = &volinfo->rebal;
rebal->defrag_cmd = cmd;
@@ -9878,10 +9690,7 @@ glusterd_validate_volume_id(dict_t *op_dict, glusterd_volinfo_t *volinfo)
uuid_t vol_uid = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(op_dict, "vol-id", SLEN("vol-id"), &volid_str);
if (ret) {
@@ -9926,14 +9735,12 @@ glusterd_defrag_volume_status_update(glusterd_volinfo_t *volinfo,
gf_defrag_status_t status = GF_DEFRAG_STATUS_NOT_STARTED;
uint64_t failures = 0;
uint64_t skipped = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
double run_time = 0;
uint64_t promoted = 0;
uint64_t demoted = 0;
uint64_t time_left = 0;
- this = THIS;
-
ret = dict_get_uint64(rsp_dict, "files", &files);
if (ret)
gf_msg_trace(this->name, 0, "failed to get file count");
@@ -10006,10 +9813,6 @@ glusterd_check_topology_identical(const char *filename1, const char *filename2,
glusterfs_graph_t *grph1 = NULL;
glusterfs_graph_t *grph2 = NULL;
- /* Invalid xlator, Nothing to do */
- if (!this)
- return (-1);
-
/* Sanitize the inputs */
GF_VALIDATE_OR_GOTO(this->name, filename1, out);
GF_VALIDATE_OR_GOTO(this->name, filename2, out);
@@ -10075,15 +9878,13 @@ glusterd_check_files_identical(char *filename1, char *filename2,
};
uint32_t cksum1 = 0;
uint32_t cksum2 = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
GF_ASSERT(filename1);
GF_ASSERT(filename2);
GF_ASSERT(identical);
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -10136,9 +9937,7 @@ glusterd_volset_help(dict_t *dict, char **op_errstr)
int ret = -1;
gf_boolean_t xml_out = _gf_false;
#if (!HAVE_LIB_XML)
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
#endif
if (!dict) {
@@ -10188,17 +9987,13 @@ glusterd_to_cli(rpcsvc_request_t *req, gf_cli_rsp *arg, struct iovec *payload,
char *cmd = NULL;
int op_ret = 0;
char *op_errstr = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
op_ret = arg->op_ret;
op_errstr = arg->op_errstr;
ret = dict_get_strn(dict, "cmd-str", SLEN("cmd-str"), &cmd);
if (ret)
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get command "
"string");
@@ -10319,10 +10114,8 @@ glusterd_aggr_brick_mount_dirs(dict_t *aggr, dict_t *rsp_dict)
int32_t brick_count = -1;
int32_t ret = -1;
int32_t i = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(aggr);
GF_ASSERT(rsp_dict);
@@ -10416,10 +10209,6 @@ glusterd_rb_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
int32_t dst_port = 0;
int ret = 0;
dict_t *ctx = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
if (aggr) {
ctx = aggr;
@@ -10448,7 +10237,7 @@ glusterd_rb_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
ret = glusterd_aggr_brick_mount_dirs(ctx, rsp_dict);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL,
"Failed to "
"aggregate brick mount dirs");
goto out;
@@ -10483,11 +10272,9 @@ glusterd_sync_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
int ret = 0;
GF_ASSERT(rsp_dict);
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!rsp_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
}
@@ -10527,15 +10314,12 @@ glusterd_profile_volume_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
int32_t brick_count = 0;
int32_t count = 0;
dict_t *ctx_dict = NULL;
- xlator_t *this = NULL;
GF_ASSERT(rsp_dict);
- this = THIS;
- GF_ASSERT(this);
ret = dict_get_int32n(rsp_dict, "count", SLEN("count"), &brick_count);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=count", NULL);
ret = 0; // no bricks in the rsp
goto out;
@@ -10544,7 +10328,7 @@ glusterd_profile_volume_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
ctx_dict = aggr;
} else {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_OPCTX_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_OPCTX_GET_FAIL,
"Operation Context is not present");
ret = -1;
goto out;
@@ -10634,7 +10418,6 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
dict_t *rsp_dict)
{
int ret = -1;
- xlator_t *this = NULL;
int local_count = 0;
int remote_count = 0;
int i = 0;
@@ -10650,12 +10433,9 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
GF_ASSERT(ctx_dict);
GF_ASSERT(rsp_dict);
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_int32n(rsp_dict, "tasks", SLEN("tasks"), &remote_count);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get remote task count");
goto out;
}
@@ -10667,14 +10447,14 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
ret = dict_foreach(
rsp_dict, glusterd_volume_status_copy_tasks_to_ctx_dict, ctx_dict);
if (ret)
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Failed to copy tasks"
"to ctx_dict.");
goto out;
}
if (local_count != remote_count) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_TASKS_COUNT_MISMATCH,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_TASKS_COUNT_MISMATCH,
"Local tasks count (%d) and "
"remote tasks count (%d) do not match. Not aggregating "
"tasks status.",
@@ -10691,7 +10471,7 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
keylen = snprintf(key, sizeof(key), "task%d.type", i);
ret = dict_get_strn(rsp_dict, key, keylen, &task_type);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get task typpe from rsp dict");
goto out;
}
@@ -10708,14 +10488,14 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
keylen = snprintf(key, sizeof(key), "task%d.status", i);
ret = dict_get_int32n(rsp_dict, key, keylen, &remote_status);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get task status from rsp dict");
goto out;
}
keylen = snprintf(key, sizeof(key), "task%d.id", i);
ret = dict_get_strn(rsp_dict, key, keylen, &remote_task_id);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get task id from rsp dict");
goto out;
}
@@ -10723,7 +10503,7 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
keylen = snprintf(key, sizeof(key), "task%d.id", j);
ret = dict_get_strn(ctx_dict, key, keylen, &local_task_id);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get local task-id");
goto out;
}
@@ -10732,7 +10512,7 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
strlen(remote_task_id))) {
/* Quit if a matching local task is not found */
if (j == (local_count - 1)) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0,
GD_MSG_TASKS_COUNT_MISMATCH,
"Could not find matching local "
"task for task %s",
@@ -10745,7 +10525,7 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
keylen = snprintf(key, sizeof(key), "task%d.status", j);
ret = dict_get_int32n(ctx_dict, key, keylen, &local_status);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get local task status");
goto out;
}
@@ -10771,7 +10551,7 @@ glusterd_volume_status_aggregate_tasks_status(dict_t *ctx_dict,
if (rank[remote_status] <= rank[local_status])
ret = dict_set_int32n(ctx_dict, key, keylen, remote_status);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0,
GD_MSG_TASK_STATUS_UPDATE_FAIL,
"Failed to "
"update task status");
@@ -10816,8 +10596,6 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
glusterd_volinfo_t *volinfo = NULL;
GF_ASSERT(rsp_dict);
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (aggr) {
ctx_dict = aggr;
@@ -10828,7 +10606,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32n(ctx_dict, "cmd", SLEN("cmd"), &cmd);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "Key=cmd",
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "Key=cmd",
NULL);
goto out;
}
@@ -10840,7 +10618,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32n(ctx_dict, "vol_count", SLEN("vol_count"),
vol_count);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=vol_count", NULL);
goto out;
}
@@ -10849,14 +10627,14 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
keylen = snprintf(key, sizeof(key), "vol%d", i);
ret = dict_get_strn(rsp_dict, key, keylen, &volname);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=%s", key, NULL);
goto out;
}
ret = dict_set_strn(ctx_dict, key, keylen, volname);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=%s", key, NULL);
goto out;
}
@@ -10873,7 +10651,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32n(rsp_dict, "count", SLEN("count"), &rsp_node_count);
if (ret) {
- gf_smsg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED, "Key=count",
+ gf_smsg(THIS->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED, "Key=count",
NULL);
ret = 0; // no bricks in the rsp
goto out;
@@ -10882,7 +10660,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32n(rsp_dict, "other-count", SLEN("other-count"),
&rsp_other_count);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=other-count", NULL);
goto out;
}
@@ -10894,14 +10672,14 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32n(rsp_dict, "brick-index-max",
SLEN("brick-index-max"), &brick_index_max);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=brick-index-max", NULL);
goto out;
}
ret = dict_set_int32n(ctx_dict, "brick-index-max",
SLEN("brick-index-max"), brick_index_max);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=brick-index-max", NULL);
goto out;
}
@@ -10910,7 +10688,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32n(ctx_dict, "brick-index-max",
SLEN("brick-index-max"), &brick_index_max);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=brick-index-max", NULL);
goto out;
}
@@ -10926,7 +10704,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32n(ctx_dict, "count", SLEN("count"),
node_count + rsp_node_count);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=count", NULL);
goto out;
}
@@ -10934,21 +10712,21 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32n(ctx_dict, "other-count", SLEN("other-count"),
(other_count + rsp_other_count));
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=other-count", NULL);
goto out;
}
ret = dict_get_strn(ctx_dict, "volname", SLEN("volname"), &volname);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Key=volname", NULL);
goto out;
}
ret = glusterd_volinfo_find(volname, &volinfo);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
"Volume=%s", volname, NULL);
goto out;
}
@@ -10963,7 +10741,7 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32n(ctx_dict, "type", SLEN("type"), type);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=type", NULL);
goto out;
}
@@ -11038,16 +10816,13 @@ glusterd_volume_bitrot_scrub_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
char *scrub_state = NULL;
char *scrub_impact = NULL;
char *bad_gfid_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
int src_count = 0;
int dst_count = 0;
int8_t scrub_running = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -11267,14 +11042,11 @@ glusterd_bitrot_volume_node_rsp(dict_t *aggr, dict_t *rsp_dict)
char *scrub_state = NULL;
char *scrub_impact = NULL;
char *bad_gfid_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *volinfo = NULL;
int8_t scrub_running = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -11497,11 +11269,9 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
int32_t value32 = 0;
uint64_t value = 0;
char *peer_uuid_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(rsp_dict);
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
if (conf->op_version < GD_OP_VERSION_6_0)
@@ -11563,7 +11333,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
keylen = snprintf(key, sizeof(key), "node-uuid-%d", current_index);
ret = dict_set_dynstrn(ctx_dict, key, keylen, node_uuid_str);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set node-uuid");
+ gf_msg_debug(this->name, 0, "failed to set node-uuid");
}
}
@@ -11573,7 +11343,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "files-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set the file count");
+ gf_msg_debug(this->name, 0, "failed to set the file count");
}
}
@@ -11583,7 +11353,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "size-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set the size of migration");
+ gf_msg_debug(this->name, 0, "failed to set the size of migration");
}
}
@@ -11593,7 +11363,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "lookups-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set looked up file count");
+ gf_msg_debug(this->name, 0, "failed to set looked up file count");
}
}
@@ -11603,7 +11373,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
keylen = snprintf(key, sizeof(key), "status-%d", current_index);
ret = dict_set_int32n(ctx_dict, key, keylen, value32);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set status");
+ gf_msg_debug(this->name, 0, "failed to set status");
}
}
@@ -11613,7 +11383,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "failures-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set failure count");
+ gf_msg_debug(this->name, 0, "failed to set failure count");
}
}
@@ -11623,7 +11393,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "skipped-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set skipped count");
+ gf_msg_debug(this->name, 0, "failed to set skipped count");
}
}
snprintf(key, sizeof(key), "run-time-%d", index);
@@ -11632,7 +11402,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "run-time-%d", current_index);
ret = dict_set_double(ctx_dict, key, elapsed_time);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set run-time");
+ gf_msg_debug(this->name, 0, "failed to set run-time");
}
}
@@ -11642,7 +11412,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "time-left-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set time-left");
+ gf_msg_debug(this->name, 0, "failed to set time-left");
}
}
snprintf(key, sizeof(key), "demoted-%d", index);
@@ -11651,7 +11421,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "demoted-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set demoted count");
+ gf_msg_debug(this->name, 0, "failed to set demoted count");
}
}
snprintf(key, sizeof(key), "promoted-%d", index);
@@ -11660,7 +11430,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict)
snprintf(key, sizeof(key), "promoted-%d", current_index);
ret = dict_set_uint64(ctx_dict, key, value);
if (ret) {
- gf_msg_debug(THIS->name, 0, "failed to set promoted count");
+ gf_msg_debug(this->name, 0, "failed to set promoted count");
}
}
@@ -11822,12 +11592,9 @@ glusterd_volume_quota_copy_to_op_ctx_dict(dict_t *dict, dict_t *rsp_dict)
char *uuid_str_dup = NULL;
char key[64] = "";
int keylen;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int type = GF_QUOTA_OPTION_TYPE_NONE;
- this = THIS;
- GF_ASSERT(this);
-
ret = dict_get_int32n(dict, "type", SLEN("type"), &type);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
@@ -11915,19 +11682,12 @@ glusterd_profile_volume_brick_rsp(void *pending_entry, dict_t *rsp_dict,
int keylen;
char *full_brick = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
- glusterd_conf_t *priv = NULL;
GF_ASSERT(rsp_dict);
GF_ASSERT(op_ctx);
GF_ASSERT(op_errstr);
GF_ASSERT(pending_entry);
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
- GF_ASSERT(priv);
-
ret = dict_get_int32n(op_ctx, "count", SLEN("count"), &count);
if (ret) {
count = 1;
@@ -12361,47 +12121,48 @@ glusterd_rebalance_rsp(dict_t *op_ctx, glusterd_rebalance_t *index, int32_t i)
int ret = 0;
char key[64] = "";
int keylen;
+ xlator_t *this = THIS;
snprintf(key, sizeof(key), "files-%d", i);
ret = dict_set_uint64(op_ctx, key, index->rebalance_files);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set file count");
snprintf(key, sizeof(key), "size-%d", i);
ret = dict_set_uint64(op_ctx, key, index->rebalance_data);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set size of xfer");
snprintf(key, sizeof(key), "lookups-%d", i);
ret = dict_set_uint64(op_ctx, key, index->lookedup_files);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set lookedup file count");
keylen = snprintf(key, sizeof(key), "status-%d", i);
ret = dict_set_int32n(op_ctx, key, keylen, index->defrag_status);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set status");
snprintf(key, sizeof(key), "failures-%d", i);
ret = dict_set_uint64(op_ctx, key, index->rebalance_failures);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set failure count");
snprintf(key, sizeof(key), "skipped-%d", i);
ret = dict_set_uint64(op_ctx, key, index->skipped_files);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set skipped count");
snprintf(key, sizeof(key), "run-time-%d", i);
ret = dict_set_double(op_ctx, key, index->rebalance_time);
if (ret)
- gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"failed to set run-time");
return ret;
@@ -12591,13 +12352,10 @@ glusterd_generate_and_set_task_id(dict_t *dict, char *key, const int keylen)
0,
};
char *uuid_str = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
GF_ASSERT(dict);
- this = THIS;
- GF_ASSERT(this);
-
gf_uuid_generate(task_id);
uuid_str = gf_strdup(uuid_utoa(task_id));
if (!uuid_str) {
@@ -12731,7 +12489,6 @@ op_version_check(xlator_t *this, int min_op_version, char *msg, int msglen)
int ret = 0;
glusterd_conf_t *priv = NULL;
- GF_ASSERT(this);
GF_ASSERT(msg);
priv = this->private;
@@ -12885,14 +12642,10 @@ glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
char *uuid1_str = NULL;
char *uuid1_str_dup = NULL;
char *uuid2_str = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
ret = dict_get_int32n(op_ctx, "type", SLEN("type"), &op_code);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get quota opcode");
goto out;
}
@@ -12907,14 +12660,14 @@ glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
ret = dict_get_strn(op_ctx, "path", SLEN("path"), &path);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get path");
goto out;
}
ret = dict_get_int32n(op_ctx, "count", SLEN("count"), &count);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get count");
goto out;
}
@@ -12943,7 +12696,7 @@ glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
ret = dict_get_strn(op_ctx, key, keylen, &uuid1_str);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get key '%s'", key);
goto out;
}
@@ -12955,7 +12708,7 @@ glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
ret = dict_get_strn(op_ctx, key, keylen, &uuid2_str);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Failed to get key "
"'%s'",
key);
@@ -12983,13 +12736,13 @@ glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
ret = dict_set_dynstrn(req_dict, "gfid", SLEN("gfid"), uuid1_str_dup);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Failed to set gfid");
GF_FREE(uuid1_str_dup);
goto out;
}
} else {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_ITER_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_ITER_FAIL,
"Failed to iterate through %d"
" entries in the req dict",
count);
@@ -13008,13 +12761,10 @@ glusterd_clean_up_quota_store(glusterd_volinfo_t *volinfo)
char voldir[PATH_MAX] = "";
char quota_confpath[PATH_MAX] = "";
char cksum_path[PATH_MAX] = "";
- xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
GLUSTERD_GET_VOLUME_DIR(voldir, volinfo, conf);
@@ -13043,10 +12793,7 @@ glusterd_remove_auxiliary_mount(char *volname)
{
int ret = -1;
char mountdir[PATH_MAX] = "";
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(mountdir, volname, "/");
ret = gf_umount_lazy(this->name, mountdir, 1);
@@ -13070,16 +12817,12 @@ int
gd_stop_rebalance_process(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
char pidfile[PATH_MAX] = "";
GF_ASSERT(volinfo);
- this = THIS;
- GF_ASSERT(this);
-
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
GLUSTERD_GET_DEFRAG_PID_FILE(pidfile, volinfo, conf);
@@ -13126,11 +12869,9 @@ gd_default_synctask_cbk(int ret, call_frame_t *frame, void *opaque)
void
glusterd_launch_synctask(synctask_fn_t fn, void *opaque)
{
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
- this = THIS;
-
/* synclock_lock must be called from within synctask, @fn must call it
* before it starts with its work*/
ret = synctask_new(this->ctx->env, fn, gd_default_synctask_cbk, NULL,
@@ -13165,7 +12906,7 @@ int
glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
#ifdef IPV6_DEFAULT
char *addr_family = "inet6";
@@ -13173,9 +12914,6 @@ glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option)
char *addr_family = "inet";
#endif
- this = THIS;
- GF_ASSERT(this);
-
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
conf = this->private;
@@ -13336,16 +13074,13 @@ glusterd_update_mntopts(char *brick_path, glusterd_brickinfo_t *brickinfo)
struct mntent save_entry = {
0,
};
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(brick_path);
GF_ASSERT(brickinfo);
ret = glusterd_get_brick_root(brick_path, &mnt_pt);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BRICKPATH_ROOT_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_BRICKPATH_ROOT_GET_FAIL,
"getting the root "
"of the brick (%s) failed ",
brick_path);
@@ -13355,7 +13090,7 @@ glusterd_update_mntopts(char *brick_path, glusterd_brickinfo_t *brickinfo)
entry = glusterd_get_mnt_entry_info(mnt_pt, buff, sizeof(buff),
&save_entry);
if (!entry) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_MNTENTRY_GET_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_MNTENTRY_GET_FAIL,
"getting the mount entry for "
"the brick (%s) failed",
brick_path);
@@ -13386,7 +13121,7 @@ glusterd_get_value_for_vme_entry(struct volopt_map_entry *vme, char **def_val)
{
int ret = -1;
char *key = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *descr = NULL;
char *local_def_val = NULL;
void *dl_handle = NULL;
@@ -13394,9 +13129,6 @@ glusterd_get_value_for_vme_entry(struct volopt_map_entry *vme, char **def_val)
{0},
};
- this = THIS;
- GF_ASSERT(this);
-
CDS_INIT_LIST_HEAD(&vol_opt_handle.list);
if (_get_xlator_opt_key_from_vme(vme, &key)) {
@@ -13503,7 +13235,7 @@ glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *ctx,
gf_boolean_t all_opts = _gf_false;
gf_boolean_t key_found = _gf_false;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *key = NULL;
char *key_fixed = NULL;
char dict_key[50] = "";
@@ -13514,9 +13246,6 @@ glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *ctx,
gf_boolean_t exists = _gf_false;
gf_boolean_t need_free = _gf_false;
- this = THIS;
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -13663,7 +13392,7 @@ glusterd_get_default_val_for_volopt(dict_t *ctx, gf_boolean_t all_opts,
struct volopt_map_entry *vme = NULL;
int ret = -1;
int count = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *def_val = NULL;
char *def_val_str = NULL;
char dict_key[50] = "";
@@ -13673,9 +13402,6 @@ glusterd_get_default_val_for_volopt(dict_t *ctx, gf_boolean_t all_opts,
glusterd_conf_t *priv = NULL;
dict_t *vol_dict = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -13931,12 +13657,10 @@ glusterd_check_client_op_version_support(char *volname, uint32_t op_version,
char **op_errstr)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
rpc_transport_t *xprt = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -13978,12 +13702,9 @@ glusterd_check_client_op_version_support(char *volname, uint32_t op_version,
gf_boolean_t
glusterd_have_peers()
{
- xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
- conf = this->private;
+ conf = THIS->private;
GF_ASSERT(conf);
return !cds_list_empty(&conf->peers);
@@ -14195,10 +13916,8 @@ glusterd_count_connected_peers(int32_t *count)
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_conf_t *conf = NULL;
int32_t ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
GF_VALIDATE_OR_GOTO(this->name, count, out);
@@ -14258,7 +13977,6 @@ glusterd_handle_replicate_brick_ops(glusterd_volinfo_t *volinfo,
char *volfileserver = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, priv, out);
@@ -14460,14 +14178,11 @@ glusterd_brick_op_prerequisites(dict_t *dict, char **op, glusterd_op_t *gd_op,
gsync_status_param_t param = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *v = NULL;
glusterd_brickinfo_t *b = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -14594,13 +14309,10 @@ glusterd_get_dst_brick_info(char **dst_brick, char *volname, char **op_errstr,
char *path = NULL;
char *c = NULL;
char msg[2048] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int ret = 0;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -14668,14 +14380,12 @@ int
glusterd_get_volinfo_from_brick(char *brick, glusterd_volinfo_t **volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *voliter = NULL;
glusterd_brickinfo_t *brickiter = NULL;
glusterd_snap_t *snap = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -14772,12 +14482,9 @@ glusterd_add_shd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict,
char key[64] = {0};
int keylen;
char *pidfile = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *uuid_str = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO(THIS->name, this, out);
-
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
GF_VALIDATE_OR_GOTO(this->name, dict, out);
@@ -14838,8 +14545,7 @@ out:
if (uuid_str)
GF_FREE(uuid_str);
if (ret)
- gf_msg(this ? this->name : "glusterd", GF_LOG_ERROR, 0,
- GD_MSG_DICT_SET_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Returning %d. adding values to dict failed", ret);
return ret;
@@ -14887,7 +14593,7 @@ glusterd_check_brick_order(dict_t *dict, char *err_str, int32_t type,
int i = 0;
int j = 0;
int k = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
addrinfo_list_t *ai_list = NULL;
addrinfo_list_t *ai_list_tmp1 = NULL;
addrinfo_list_t *ai_list_tmp2 = NULL;
@@ -14919,10 +14625,6 @@ glusterd_check_brick_order(dict_t *dict, char *err_str, int32_t type,
"command if you want to override this "
"behavior. ";
- this = THIS;
-
- GF_ASSERT(this);
-
ai_list = MALLOC(sizeof(addrinfo_list_t));
ai_list->info = NULL;
CDS_INIT_LIST_HEAD(&ai_list->list);
@@ -15165,14 +14867,12 @@ glusterd_add_peers_to_auth_list(char *volname)
int ret = 0;
glusterd_volinfo_t *volinfo = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
int32_t len = 0;
char *auth_allow_list = NULL;
char *new_auth_allow_list = NULL;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -15253,12 +14953,9 @@ glusterd_replace_old_auth_allow_list(char *volname)
{
int ret = 0;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *old_auth_allow_list = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_VALIDATE_OR_GOTO(this->name, volname, out);
ret = glusterd_volinfo_find(volname, &volinfo);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 5bdef4d56e..347559f96d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -91,7 +91,6 @@ xlator_instantiate_va(const char *type, const char *format, va_list arg)
char *volname = NULL;
int ret = 0;
xlator_t *this = THIS;
- GF_ASSERT(this);
ret = gf_vasprintf(&volname, format, arg);
if (ret < 0) {
@@ -119,7 +118,7 @@ xlator_instantiate_va(const char *type, const char *format, va_list arg)
xl->name = volname;
CDS_INIT_LIST_HEAD(&xl->volume_options);
- xl->ctx = THIS->ctx;
+ xl->ctx = this->ctx;
return xl;
@@ -764,7 +763,6 @@ glusterd_check_option_exists(char *key, char **completion)
};
struct volopt_map_entry *vmep = NULL;
int ret = 0;
- xlator_t *this = THIS;
(void)vme;
(void)vmep;
@@ -773,7 +771,7 @@ glusterd_check_option_exists(char *key, char **completion)
if (completion) {
ret = option_complete(key, completion);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
+ gf_msg(THIS->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
"Out of memory");
return -1;
}
@@ -800,7 +798,7 @@ glusterd_check_option_exists(char *key, char **completion)
trie:
ret = volopt_trie(key, completion);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_ERROR_ENCOUNTERED,
+ gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_ERROR_ENCOUNTERED,
"Some error occurred during keyword hinting");
}
@@ -813,10 +811,9 @@ glusterd_volopt_validate(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
struct volopt_map_entry *vme = NULL;
int ret = 0;
- xlator_t *this = THIS;
if (!dict || !key || !value) {
- gf_msg_callingfn(this->name, GF_LOG_WARNING, EINVAL,
+ gf_msg_callingfn(THIS->name, GF_LOG_WARNING, EINVAL,
GD_MSG_INVALID_ENTRY,
"Invalid "
"Arguments (dict=%p, key=%s, value=%s)",
@@ -829,7 +826,7 @@ glusterd_volopt_validate(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
(!strcmp(key, strchr(vme->key, '.') + 1)))) {
if ((vme->type != GLOBAL_DOC && vme->type != GLOBAL_NO_DOC) &&
!volinfo) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY,
"%s is not"
" a global option",
vme->key);
@@ -875,7 +872,6 @@ _xl_link_children(xlator_t *parent, xlator_t *children, size_t child_count)
size_t seek = 0;
int ret = -1;
xlator_t *this = THIS;
- GF_ASSERT(this);
if (child_count == 0)
goto out;
@@ -990,9 +986,7 @@ volgen_write_volfile(volgen_graph_t *graph, char *filename)
char *ftmp = NULL;
FILE *f = NULL;
int fd = 0;
- xlator_t *this = NULL;
-
- this = THIS;
+ xlator_t *this = THIS;
if (gf_asprintf(&ftmp, "%s.tmp", filename) == -1) {
ftmp = NULL;
@@ -1016,7 +1010,7 @@ volgen_write_volfile(volgen_graph_t *graph, char *filename)
goto error;
if (fclose(f) != 0) {
- gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
"fclose on the file %s "
"failed",
ftmp);
@@ -1488,19 +1482,17 @@ volgen_graph_set_xl_options(volgen_graph_t *graph, dict_t *dict)
}; /* for posix* -> *posix* */
char *loglevel = NULL;
xlator_t *trav = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_str_sizen(dict, "xlator", &xlator);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=xlator", NULL);
goto out;
}
ret = dict_get_str_sizen(dict, "loglevel", &loglevel);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=loglevel", NULL);
goto out;
}
@@ -1603,19 +1595,17 @@ gfproxy_server_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *password = NULL;
/*int rclusters = 0;*/
- xlator_t *this = THIS;
- GF_ASSERT(this);
/* We are a trusted client */
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
if (ret != 0) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto out;
}
ret = dict_set_int32_sizen(set_dict, "gfproxy-server", 1);
if (ret != 0) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=gfproxy-server", NULL);
goto out;
}
@@ -1676,11 +1666,9 @@ brick_graph_add_posix(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
gf_boolean_t pgfid_feat = _gf_false;
char *value = NULL;
xlator_t *xl = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
-
if (!graph || !volinfo || !set_dict || !brickinfo) {
gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
@@ -1750,11 +1738,9 @@ brick_graph_add_selinux(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1821,10 +1807,9 @@ brick_graph_add_bitrot_stub(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xlator_t *xl = NULL;
int ret = -1;
char *value = NULL;
- xlator_t *this = THIS;
if (!graph || !volinfo || !set_dict || !brickinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1834,7 +1819,7 @@ brick_graph_add_bitrot_stub(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = xlator_set_fixed_option(xl, "export", brickinfo->path);
if (ret) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_log(THIS->name, GF_LOG_WARNING,
"failed to set the export "
"option in bit-rot-stub");
goto out;
@@ -1843,7 +1828,7 @@ brick_graph_add_bitrot_stub(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = glusterd_volinfo_get(volinfo, VKEY_FEATURES_BITROT, &value);
ret = xlator_set_fixed_option(xl, "bitrot", value);
if (ret)
- gf_log(this->name, GF_LOG_WARNING,
+ gf_log(THIS->name, GF_LOG_WARNING,
"failed to set bitrot "
"enable option in bit-rot-stub");
@@ -1861,11 +1846,9 @@ brick_graph_add_changelog(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
};
int ret = -1;
int32_t len = 0;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict || !brickinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1880,7 +1863,7 @@ brick_graph_add_changelog(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
len = snprintf(changelog_basepath, sizeof(changelog_basepath), "%s/%s",
brickinfo->path, ".glusterfs/changelogs");
if ((len < 0) || (len >= sizeof(changelog_basepath))) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
ret = -1;
goto out;
}
@@ -1910,11 +1893,9 @@ brick_graph_add_acl(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1946,11 +1927,9 @@ brick_graph_add_locks(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1969,11 +1948,9 @@ brick_graph_add_iot(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -1991,10 +1968,9 @@ brick_graph_add_barrier(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
if (!graph || !volinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2013,11 +1989,9 @@ brick_graph_add_sdfs(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2047,11 +2021,9 @@ brick_graph_add_namespace(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2106,11 +2078,9 @@ brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char index_basepath[PATH_MAX] = {0};
int ret = -1;
int32_t len = 0;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !brickinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2121,7 +2091,7 @@ brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
len = snprintf(index_basepath, sizeof(index_basepath), "%s/%s",
brickinfo->path, ".glusterfs/indices");
if ((len < 0) || (len >= sizeof(index_basepath))) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_COPY_FAIL, NULL);
goto out;
}
@@ -2168,11 +2138,9 @@ brick_graph_add_marker(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char buf[32] = {
0,
};
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2205,11 +2173,9 @@ brick_graph_add_quota(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int ret = -1;
xlator_t *xl = NULL;
char *value = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2237,11 +2203,9 @@ brick_graph_add_ro(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2273,11 +2237,9 @@ brick_graph_add_worm(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2306,11 +2268,9 @@ brick_graph_add_cdc(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2339,11 +2299,10 @@ brick_graph_add_io_stats(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
int ret = -1;
xlator_t *xl = NULL;
- xlator_t *this = THIS;
- glusterd_conf_t *priv = this->private;
+ glusterd_conf_t *priv = THIS->private;
if (!graph || !set_dict || !brickinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2373,11 +2332,9 @@ brick_graph_add_upcall(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2399,11 +2356,9 @@ brick_graph_add_leases(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2435,11 +2390,9 @@ brick_graph_add_server(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *volname = NULL;
char *address_family_data = NULL;
int32_t len = 0;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict || !brickinfo) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
@@ -2550,17 +2503,15 @@ brick_graph_add_pump(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *password = NULL;
char *ptranst = NULL;
char *address_family_data = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
if (!graph || !volinfo || !set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
ret = dict_get_int32(volinfo->dict, "enable-pump", &pump);
if (ret == -ENOENT) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=enable-pump", NULL);
ret = pump = 0;
}
@@ -2821,14 +2772,11 @@ perfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
{
gf_boolean_t enabled = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
GF_VALIDATE_OR_GOTO("glusterd", param, out);
volinfo = param;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
- priv = this->private;
+ priv = THIS->private;
GF_VALIDATE_OR_GOTO("glusterd", priv, out);
if (strcmp(vme->option, "!perf") != 0)
@@ -3706,7 +3654,7 @@ set_afr_pending_xattrs_option(volgen_graph_t *graph,
{
xlator_t *xlator = NULL;
xlator_t **afr_xlators_list = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_brickinfo_t *brick = NULL;
glusterd_brickinfo_t *ta_brick = NULL;
@@ -3719,8 +3667,6 @@ set_afr_pending_xattrs_option(volgen_graph_t *graph,
int ta_brick_index = 0;
int subvol_index = 0;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -3815,10 +3761,8 @@ set_volfile_id_option(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int i = 0;
int ret = -1;
glusterd_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -4199,7 +4143,6 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int ret = 0;
xlator_t *xl = NULL;
char *volname = NULL;
- glusterd_conf_t *conf = THIS->private;
char *tmp = NULL;
gf_boolean_t var = _gf_false;
gf_boolean_t ob = _gf_false;
@@ -4209,8 +4152,8 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
size_t namelen = 0;
char *xl_id = NULL;
gf_boolean_t gfproxy_clnt = _gf_false;
+ glusterd_conf_t *conf = this->private;
- GF_ASSERT(this);
GF_ASSERT(conf);
ret = dict_get_str_boolean(set_dict, "gfproxy-client", 0);
@@ -4806,11 +4749,8 @@ build_rebalance_volfile(glusterd_volinfo_t *volinfo, char *filepath,
};
xlator_t *xl = NULL;
int ret = -1;
- xlator_t *this = NULL;
dict_t *set_dict = NULL;
- this = THIS;
-
graph.type = GF_REBALANCED;
if (volinfo->brick_count <= volinfo->dist_leaf_count) {
@@ -4850,7 +4790,7 @@ build_rebalance_volfile(glusterd_volinfo_t *volinfo, char *filepath,
goto out;
}
- ret = graph_set_generic_options(this, &graph, set_dict, "rebalance-daemon");
+ ret = graph_set_generic_options(THIS, &graph, set_dict, "rebalance-daemon");
if (ret)
goto out;
@@ -4912,17 +4852,14 @@ int
build_shd_graph(glusterd_volinfo_t *volinfo, volgen_graph_t *graph,
dict_t *mod_dict)
{
- xlator_t *this = NULL;
dict_t *set_dict = NULL;
int ret = 0;
xlator_t *iostxl = NULL;
gf_boolean_t graph_check = _gf_false;
- this = THIS;
-
set_dict = dict_new();
if (!set_dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
ret = -ENOMEM;
goto out;
}
@@ -4935,7 +4872,7 @@ build_shd_graph(glusterd_volinfo_t *volinfo, volgen_graph_t *graph,
goto out;
}
- ret = build_shd_volume_graph(this, graph, volinfo, mod_dict, set_dict,
+ ret = build_shd_volume_graph(THIS, graph, volinfo, mod_dict, set_dict,
graph_check);
out:
@@ -4971,7 +4908,6 @@ build_nfs_graph(volgen_graph_t *graph, dict_t *mod_dict)
0,
};
glusterd_volinfo_t *voliter = NULL;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
dict_t *set_dict = NULL;
xlator_t *nfsxl = NULL;
@@ -4983,9 +4919,7 @@ build_nfs_graph(volgen_graph_t *graph, dict_t *mod_dict)
char *volname = NULL;
data_t *data = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
set_dict = dict_new();
@@ -5170,10 +5104,8 @@ get_brick_filepath(char *filename, glusterd_volinfo_t *volinfo,
char brick[PATH_MAX] = {
0,
};
- glusterd_conf_t *priv = NULL;
int32_t len = 0;
-
- priv = THIS->private;
+ glusterd_conf_t *priv = THIS->private;
GLUSTERD_REMOVE_SLASH_FROM_PATH(brickinfo->path, brick);
GLUSTERD_GET_VOLUME_DIR(path, volinfo, priv);
@@ -5198,14 +5130,10 @@ glusterd_is_valid_volfpath(char *volname, char *brick)
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
int32_t ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
ret = glusterd_brickinfo_new_from_brick(brick, &brickinfo, _gf_false, NULL);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_BRICKINFO_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_BRICKINFO_CREATE_FAIL,
"Failed to create brickinfo"
" for brick %s",
brick);
@@ -5214,7 +5142,7 @@ glusterd_is_valid_volfpath(char *volname, char *brick)
}
ret = glusterd_volinfo_new(&volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_STORE_FAIL,
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_STORE_FAIL,
"Failed to create volinfo");
ret = 0;
goto out;
@@ -5300,17 +5228,13 @@ build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict)
{
volgen_graph_t cgraph = {0};
glusterd_volinfo_t *voliter = NULL;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
dict_t *set_dict = NULL;
int ret = 0;
xlator_t *quotad_xl = NULL;
char *skey = NULL;
- this = THIS;
- GF_ASSERT(this);
-
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
graph->type = GF_QUOTAD;
@@ -5337,7 +5261,7 @@ build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict)
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto out;
}
@@ -5397,10 +5321,7 @@ out:
static void
get_vol_tstamp_file(char *filename, glusterd_volinfo_t *volinfo)
{
- glusterd_conf_t *priv = NULL;
-
- priv = THIS->private;
-
+ glusterd_conf_t *priv = THIS->private;
GLUSTERD_GET_VOLUME_DIR(filename, volinfo, priv);
strncat(filename, "/marker.tstamp", PATH_MAX - strlen(filename) - 1);
}
@@ -5409,12 +5330,9 @@ static void
get_parent_vol_tstamp_file(char *filename, glusterd_volinfo_t *volinfo)
{
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
len = snprintf(filename, PATH_MAX, "%s/vols/%s/marker.tstamp",
@@ -5434,10 +5352,7 @@ generate_brick_volfiles(glusterd_volinfo_t *volinfo)
0,
};
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = glusterd_volinfo_get_boolean(volinfo, VKEY_MARKER_XTIME);
if (ret == -1)
@@ -5536,18 +5451,16 @@ glusterd_generate_client_per_brick_volfile(glusterd_volinfo_t *volinfo)
int ret = -1;
char *ssl_str = NULL;
gf_boolean_t ssl_bool = _gf_false;
- xlator_t *this = THIS;
- GF_ASSERT(this);
dict = dict_new();
if (!dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
}
ret = dict_set_uint32(dict, "trusted-client", GF_CLIENT_TRUSTED);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto free_dict;
}
@@ -5625,21 +5538,18 @@ generate_dummy_client_volfiles(glusterd_volinfo_t *volinfo)
};
char *types[] = {NULL, NULL, NULL};
dict_t *dict = NULL;
- xlator_t *this = NULL;
gf_transport_type type = GF_TRANSPORT_TCP;
- this = THIS;
-
enumerate_transport_reqs(volinfo->transport_type, types);
dict = dict_new();
if (!dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
}
for (i = 0; types[i]; i++) {
ret = dict_set_str(dict, "client-transport-type", types[i]);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=client-transport-type", NULL);
goto out;
}
@@ -5647,14 +5557,14 @@ generate_dummy_client_volfiles(glusterd_volinfo_t *volinfo)
ret = dict_set_uint32(dict, "trusted-client", GF_CLIENT_OTHER);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto out;
}
ret = glusterd_get_dummy_client_filepath(filepath, volinfo, type);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
"Received invalid transport-type.");
goto out;
}
@@ -5684,11 +5594,8 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
char *volname = NULL;
char *types[] = {NULL, NULL, NULL};
dict_t *dict = NULL;
- xlator_t *this = NULL;
gf_transport_type type = GF_TRANSPORT_TCP;
- this = THIS;
-
volname = volinfo->is_snap_volume ? volinfo->parent_volname
: volinfo->volname;
@@ -5712,13 +5619,13 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
enumerate_transport_reqs(volinfo->transport_type, types);
dict = dict_new();
if (!dict) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_CREATE_FAIL, NULL);
goto out;
}
for (i = 0; types[i]; i++) {
ret = dict_set_str(dict, "client-transport-type", types[i]);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=client-transport-type", NULL);
goto out;
}
@@ -5726,7 +5633,7 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
ret = dict_set_uint32(dict, "trusted-client", client_type);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto out;
}
@@ -5740,7 +5647,7 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
ret = glusterd_get_client_filepath(filepath, volinfo, type);
}
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
"Received invalid transport-type");
goto out;
}
@@ -5755,7 +5662,7 @@ generate_client_volfiles(glusterd_volinfo_t *volinfo,
ret = build_rebalance_volfile(volinfo, filepath, dict);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create rebalance volfile for %s", volinfo->volname);
goto out;
}
@@ -5879,12 +5786,10 @@ prepare_bitrot_scrub_volume_options(glusterd_volinfo_t *volinfo,
dict_t *mod_dict, dict_t *set_dict)
{
int ret = 0;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_set_uint32(set_dict, "trusted-client", GF_CLIENT_TRUSTED);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=trusted-client", NULL);
goto out;
}
@@ -5935,7 +5840,7 @@ build_bitd_volume_graph(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *mod_dict, unsigned int numbricks)
{
volgen_graph_t cgraph = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
xlator_t *xl = NULL;
dict_t *set_dict = NULL;
glusterd_conf_t *priv = NULL;
@@ -5947,9 +5852,6 @@ build_bitd_volume_graph(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
0,
};
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -6017,15 +5919,13 @@ int
build_bitd_graph(volgen_graph_t *graph, dict_t *mod_dict)
{
glusterd_volinfo_t *voliter = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
int ret = 0;
xlator_t *iostxl = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
unsigned int numbricks = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -6096,7 +5996,7 @@ build_scrub_volume_graph(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
{
volgen_graph_t cgraph = {0};
dict_t *set_dict = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
xlator_t *xl = NULL;
glusterd_conf_t *priv = NULL;
int ret = 0;
@@ -6107,9 +6007,6 @@ build_scrub_volume_graph(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
};
glusterd_brickinfo_t *brickinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -6174,14 +6071,11 @@ int
build_scrub_graph(volgen_graph_t *graph, dict_t *mod_dict)
{
glusterd_volinfo_t *voliter = NULL;
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
int ret = 0;
xlator_t *iostxl = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
iostxl = volgen_graph_add_as(graph, "debug/io-stats", "scrub");
@@ -6246,43 +6140,40 @@ int
glusterd_create_volfiles(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
ret = generate_brick_volfiles(volinfo);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate volfiles for bricks");
goto out;
}
ret = generate_client_volfiles(volinfo, GF_CLIENT_TRUSTED);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate trusted client volfiles");
goto out;
}
ret = generate_client_volfiles(volinfo, GF_CLIENT_TRUSTED_PROXY);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_log(THIS->name, GF_LOG_ERROR,
"Could not generate gfproxy client volfiles");
goto out;
}
ret = generate_client_volfiles(volinfo, GF_CLIENT_OTHER);
if (ret)
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate client volfiles");
ret = glusterd_generate_gfproxyd_volfile(volinfo);
if (ret)
- gf_log(this->name, GF_LOG_ERROR, "Could not generate gfproxy volfiles");
+ gf_log(THIS->name, GF_LOG_ERROR, "Could not generate gfproxy volfiles");
ret = glusterd_shdsvc_create_volfile(volinfo);
if (ret)
- gf_log(this->name, GF_LOG_ERROR, "Could not generate shd volfiles");
+ gf_log(THIS->name, GF_LOG_ERROR, "Could not generate shd volfiles");
dict_del_sizen(volinfo->dict, "skip-CLIOT");
@@ -6294,15 +6185,12 @@ int
glusterd_create_volfiles_and_notify_services(glusterd_volinfo_t *volinfo)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
ret = glusterd_create_volfiles(volinfo);
if (ret)
goto out;
- ret = glusterd_fetchspec_notify(this);
+ ret = glusterd_fetchspec_notify(THIS);
out:
return ret;
@@ -6397,8 +6285,6 @@ validate_nfsopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
};
xlator_t *this = THIS;
- GF_ASSERT(this);
-
graph.errstr = op_errstr;
get_vol_transport_type(volinfo, transport_type);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index cca0552073..229b54e75a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -56,7 +56,7 @@ __glusterd_handle_create_volume(rpcsvc_request_t *req)
gf_cli_rsp rsp = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
char *free_ptr = NULL;
char *trans_type = NULL;
@@ -77,9 +77,6 @@ __glusterd_handle_create_volume(rpcsvc_request_t *req)
GF_ASSERT(req);
- this = THIS;
- GF_ASSERT(this);
-
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -308,11 +305,9 @@ __glusterd_handle_cli_start_volume(rpcsvc_request_t *req)
char errstr[2048] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
conf = this->private;
@@ -397,14 +392,12 @@ __glusterd_handle_cli_stop_volume(rpcsvc_request_t *req)
char *dup_volname = NULL;
dict_t *dict = NULL;
glusterd_op_t cli_op = GD_OP_STOP_VOLUME;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char err_str[64] = {
0,
};
glusterd_conf_t *conf = NULL;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
conf = this->private;
GF_ASSERT(conf);
@@ -497,10 +490,6 @@ __glusterd_handle_cli_delete_volume(rpcsvc_request_t *req)
char err_str[64] = {
0,
};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(req);
@@ -509,7 +498,7 @@ __glusterd_handle_cli_delete_volume(rpcsvc_request_t *req)
snprintf(err_str, sizeof(err_str),
"Failed to decode request "
"received from cli");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_REQ_DECODE_FAIL, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_REQ_DECODE_FAIL, "%s",
err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
@@ -522,7 +511,7 @@ __glusterd_handle_cli_delete_volume(rpcsvc_request_t *req)
ret = dict_unserialize(cli_req.dict.dict_val, cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf(err_str, sizeof(err_str),
@@ -537,13 +526,13 @@ __glusterd_handle_cli_delete_volume(rpcsvc_request_t *req)
snprintf(err_str, sizeof(err_str),
"Failed to get volume "
"name");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_msg_debug(this->name, 0,
+ gf_msg_debug(THIS->name, 0,
"Received delete vol req"
"for volume %s",
volname);
@@ -575,13 +564,11 @@ glusterd_handle_heal_options_enable_disable(rpcsvc_request_t *req, dict_t *dict,
int ret = 0;
char *key = NULL;
char *value = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_int32n(dict, "heal-op", SLEN("heal-op"),
(int32_t *)&heal_op);
if (ret || (heal_op == GF_SHD_OP_INVALID)) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
"Key=heal-op", NULL);
ret = -1;
goto out;
@@ -621,7 +608,7 @@ glusterd_handle_heal_options_enable_disable(rpcsvc_request_t *req, dict_t *dict,
key = "cluster.granular-entry-heal";
ret = dict_set_int8(dict, "is-special-key", 1);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=is-special-key", NULL);
goto out;
}
@@ -629,21 +616,21 @@ glusterd_handle_heal_options_enable_disable(rpcsvc_request_t *req, dict_t *dict,
ret = dict_set_strn(dict, "key1", SLEN("key1"), key);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=key1", NULL);
goto out;
}
ret = dict_set_strn(dict, "value1", SLEN("value1"), value);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=value1", NULL);
goto out;
}
ret = dict_set_int32n(dict, "count", SLEN("count"), 1);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=count", NULL);
goto out;
}
@@ -665,14 +652,11 @@ __glusterd_handle_cli_heal_volume(rpcsvc_request_t *req)
glusterd_op_t cli_op = GD_OP_HEAL_VOLUME;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char op_errstr[2048] = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
GF_ASSERT(req);
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
@@ -755,8 +739,8 @@ out:
if (ret) {
if (op_errstr[0] == '\0')
snprintf(op_errstr, sizeof(op_errstr), "operation failed");
- gf_msg((this ? this->name : "glusterd"), GF_LOG_ERROR, 0,
- GD_MSG_GLUSTERD_OP_FAILED, "%s", op_errstr);
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_GLUSTERD_OP_FAILED, "%s",
+ op_errstr);
ret = glusterd_op_send_cli_response(cli_op, ret, 0, req, dict,
op_errstr);
}
@@ -785,12 +769,9 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
char err_str[128] = {
0,
};
- xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
- priv = this->private;
+ priv = THIS->private;
GF_ASSERT(priv);
GF_ASSERT(req);
@@ -799,7 +780,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
req->rpc_err = GARBAGE_ARGS;
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_GARBAGE_ARGS, NULL);
goto out;
}
if (cli_req.dict.dict_len) {
@@ -809,7 +790,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
ret = dict_unserialize(cli_req.dict.dict_val, cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf(err_str, sizeof(err_str),
@@ -821,7 +802,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
snprintf(err_str, sizeof(err_str), "Unable to get the volume name");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
err_str);
goto out;
}
@@ -829,7 +810,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
ret = dict_get_strn(dict, "options", SLEN("options"), &options);
if (ret) {
snprintf(err_str, sizeof(err_str), "Unable to get options");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
err_str);
goto out;
}
@@ -839,7 +820,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
snprintf(err_str, sizeof(err_str),
"Unable to get option "
"count");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "%s",
err_str);
goto out;
}
@@ -853,7 +834,7 @@ __glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req)
goto out;
}
- gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_STATEDUMP_VOL_REQ_RCVD,
+ gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_STATEDUMP_VOL_REQ_RCVD,
"Received statedump request for "
"volume %s with options %s",
volname, options);
@@ -898,7 +879,7 @@ glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr,
int32_t disperse_count = 0;
char *brick = NULL;
char *tmpptr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
char msg[2048] = {0};
uuid_t volume_uuid;
@@ -906,8 +887,6 @@ glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr,
gf_boolean_t is_force = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(rsp_dict);
@@ -1137,36 +1116,32 @@ int
glusterd_op_stop_volume_args_get(dict_t *dict, char **volname, int *flags)
{
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
if (!dict) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
if (!volname) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
if (!flags) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ARGUMENT, NULL);
goto out;
}
ret = dict_get_strn(dict, "volname", SLEN("volname"), volname);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=volname", NULL);
goto out;
}
ret = dict_get_int32n(dict, "flags", SLEN("flags"), flags);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Key=flags", NULL);
goto out;
}
@@ -1225,7 +1200,7 @@ glusterd_op_stage_start_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
0,
};
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
uuid_t volume_id = {
0,
};
@@ -1237,8 +1212,6 @@ glusterd_op_stage_start_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
};
int32_t len = 0;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
GF_ASSERT(rsp_dict);
@@ -1420,14 +1393,11 @@ glusterd_op_stage_stop_volume(dict_t *dict, char **op_errstr)
int flags = 0;
glusterd_volinfo_t *volinfo = NULL;
char msg[2048] = {0};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gsync_status_param_t param = {
0,
};
- this = THIS;
- GF_ASSERT(this);
-
ret = glusterd_op_stop_volume_args_get(dict, &volname, &flags);
if (ret) {
snprintf(msg, sizeof(msg), "Failed to get details of volume %s",
@@ -1474,7 +1444,7 @@ glusterd_op_stage_stop_volume(dict_t *dict, char **op_errstr)
if (ret) {
ret = ganesha_manage_export(dict, "off", _gf_false, op_errstr);
if (ret) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0,
+ gf_msg(this->name, GF_LOG_WARNING, 0,
GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL,
"Could not "
"unexport volume via NFS-Ganesha");
@@ -1507,10 +1477,7 @@ glusterd_op_stage_delete_volume(dict_t *dict, char **op_errstr)
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
char msg[2048] = {0};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
@@ -1682,10 +1649,7 @@ glusterd_op_stage_heal_volume(dict_t *dict, char **op_errstr)
char msg[2048];
glusterd_conf_t *priv = NULL;
dict_t *opt_dict = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
priv = this->private;
if (!priv) {
@@ -1765,11 +1729,9 @@ glusterd_op_stage_statedump_volume(dict_t *dict, char **op_errstr)
char msg[2408] = {
0,
};
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -1904,7 +1866,7 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr)
gf_boolean_t vol_added = _gf_false;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_brickinfo_t *ta_brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char *brick = NULL;
char *ta_brick = NULL;
int32_t count = 0;
@@ -1932,9 +1894,6 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr)
0,
};
- this = THIS;
- GF_ASSERT(this);
-
priv = this->private;
GF_ASSERT(priv);
@@ -2288,11 +2247,9 @@ glusterd_start_volume(glusterd_volinfo_t *volinfo, int flags, gf_boolean_t wait)
{
int ret = 0;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_volinfo_ver_ac_t verincrement = 0;
- this = THIS;
- GF_ASSERT(this);
GF_ASSERT(volinfo);
cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
@@ -2356,14 +2313,12 @@ glusterd_op_start_volume(dict_t *dict, char **op_errstr)
int flags = 0;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *conf = NULL;
glusterd_svc_t *svc = NULL;
char *str = NULL;
gf_boolean_t option = _gf_false;
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -2469,12 +2424,9 @@ glusterd_stop_volume(glusterd_volinfo_t *volinfo)
{
int ret = -1;
glusterd_brickinfo_t *brickinfo = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_svc_t *svc = NULL;
- this = THIS;
- GF_ASSERT(this);
-
GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
@@ -2528,10 +2480,7 @@ glusterd_op_stop_volume(dict_t *dict)
int flags = 0;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = glusterd_op_stop_volume_args_get(dict, &volname, &flags);
if (ret)
@@ -2561,10 +2510,7 @@ glusterd_op_delete_volume(dict_t *dict)
int ret = 0;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
@@ -2896,7 +2842,6 @@ glusterd_op_clearlocks_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
char **xl_opts = NULL;
glusterd_volinfo_t *volinfo = NULL;
xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_strn(dict, "volname", SLEN("volname"), &volname);
if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 0754a66c34..bb4ae8c4b3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -23,10 +23,8 @@ validate_cache_max_min_size(glusterd_volinfo_t *volinfo, dict_t *dict,
int ret = 0;
uint64_t max_value = 0;
uint64_t min_value = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -74,13 +72,10 @@ validate_defrag_throttle_option(glusterd_volinfo_t *volinfo, dict_t *dict,
{
char errstr[2048] = "";
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int thread_count = 0;
long int cores_available = 0;
- this = THIS;
- GF_ASSERT(this);
-
cores_available = sysconf(_SC_NPROCESSORS_ONLN);
/* Throttle option should be one of lazy|normal|aggressive or a number
@@ -129,10 +124,8 @@ validate_quota(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char errstr[2048] = "";
glusterd_conf_t *priv = NULL;
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -166,12 +159,9 @@ validate_uss(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value,
{
char errstr[2048] = "";
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t b = _gf_false;
- this = THIS;
- GF_ASSERT(this);
-
ret = gf_string2boolean(value, &b);
if (ret) {
snprintf(errstr, sizeof(errstr),
@@ -195,10 +185,7 @@ validate_uss_dir(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char errstr[2048] = "";
int ret = -1;
int i = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
i = strlen(value);
if (i > NAME_MAX) {
@@ -252,13 +239,10 @@ validate_server_options(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
char errstr[2048] = "";
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int ret = -1;
int origin_val = 0;
- this = THIS;
- GF_ASSERT(this);
-
if (volinfo->status == GLUSTERD_STATUS_STARTED) {
gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_VOL_SET_VALIDATION_INFO,
"Please note that "
@@ -304,15 +288,11 @@ validate_disperse(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
char errstr[2048] = "";
int ret = -1;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
if (volinfo->type != GF_CLUSTER_TYPE_DISPERSE) {
snprintf(errstr, sizeof(errstr),
"Cannot set %s for a non-disperse volume.", key);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOL_NOT_DISPERSE, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOL_NOT_DISPERSE, "%s",
errstr);
*op_errstr = gf_strdup(errstr);
ret = -1;
@@ -321,7 +301,7 @@ validate_disperse(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
ret = 0;
out:
- gf_msg_debug(ret == 0 ? THIS->name : "glusterd", 0, "Returning %d", ret);
+ gf_msg_debug("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -332,10 +312,7 @@ validate_replica(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
char errstr[2048] = "";
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (volinfo->replica_count == 1) {
snprintf(errstr, sizeof(errstr),
@@ -358,12 +335,9 @@ validate_quorum_count(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
int q_count = 0;
- this = THIS;
- GF_ASSERT(this);
-
ret = gf_string2int(value, &q_count);
if (ret) {
gf_asprintf(op_errstr,
@@ -397,10 +371,8 @@ validate_subvols_per_directory(glusterd_volinfo_t *volinfo, dict_t *dict,
glusterd_conf_t *priv = NULL;
int ret = 0;
int subvols = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -447,10 +419,7 @@ validate_mandatory_locking(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
{
char errstr[2048] = "";
int ret = 0;
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT(this);
+ xlator_t *this = THIS;
if (strcmp(value, "off") != 0 && strcmp(value, "file") != 0 &&
strcmp(value, "forced") != 0 && strcmp(value, "optimal") != 0) {
@@ -491,12 +460,9 @@ validate_lock_migration_option(glusterd_volinfo_t *volinfo, dict_t *dict,
{
char errstr[2048] = "";
int ret = 0;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
gf_boolean_t b = _gf_false;
- this = THIS;
- GF_ASSERT(this);
-
if (volinfo->replica_count > 1 || volinfo->disperse_count) {
snprintf(errstr, sizeof(errstr),
"Lock migration is "
@@ -536,19 +502,15 @@ static int
validate_mux_limit(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
- xlator_t *this = NULL;
uint val = 0;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
if (!is_brick_mx_enabled()) {
gf_asprintf(op_errstr,
"Brick-multiplexing is not enabled. "
"Please enable brick multiplexing before trying "
"to set this option.");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_WRONG_OPTS_SETTING, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_WRONG_OPTS_SETTING, "%s",
*op_errstr);
goto out;
}
@@ -559,7 +521,7 @@ validate_mux_limit(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
"%s is not a valid count. "
"%s expects an unsigned integer.",
value, key);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
}
@@ -581,19 +543,15 @@ static int
validate_volume_per_thread_limit(glusterd_volinfo_t *volinfo, dict_t *dict,
char *key, char *value, char **op_errstr)
{
- xlator_t *this = NULL;
uint val = 0;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
-
if (!is_brick_mx_enabled()) {
gf_asprintf(op_errstr,
"Brick-multiplexing is not enabled. "
"Please enable brick multiplexing before trying "
"to set this option.");
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_WRONG_OPTS_SETTING, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_WRONG_OPTS_SETTING, "%s",
*op_errstr);
goto out;
}
@@ -604,7 +562,7 @@ validate_volume_per_thread_limit(glusterd_volinfo_t *volinfo, dict_t *dict,
"%s is not a valid count. "
"%s expects an unsigned integer.",
value, key);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
}
@@ -626,22 +584,18 @@ static int
validate_boolean(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
- xlator_t *this = NULL;
gf_boolean_t b = _gf_false;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
ret = gf_string2boolean(value, &b);
if (ret) {
gf_asprintf(op_errstr,
"%s is not a valid boolean value. %s "
"expects a valid boolean value.",
value, key);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
}
-out:
gf_msg_debug("glusterd", 0, "Returning %d", ret);
return ret;
@@ -740,22 +694,18 @@ static int
validate_worm_period(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
- xlator_t *this = NULL;
uint64_t period = -1;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
ret = gf_string2uint64(value, &period);
if (ret) {
gf_asprintf(op_errstr,
"%s is not a valid uint64_t value."
" %s expects a valid uint64_t value.",
value, key);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
}
-out:
gf_msg_debug("glusterd", 0, "Returning %d", ret);
return ret;
@@ -765,18 +715,15 @@ static int
validate_reten_mode(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
- xlator_t *this = NULL;
int ret = -1;
- this = THIS;
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
if ((strcmp(value, "relax") && strcmp(value, "enterprise"))) {
gf_asprintf(op_errstr,
"The value of retention mode should be "
"either relax or enterprise. But the value"
" of %s is %s",
key, value);
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
ret = -1;
goto out;
@@ -799,15 +746,11 @@ static int
validate_statedump_path(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr)
{
- xlator_t *this = NULL;
- this = THIS;
- GF_ASSERT(this);
-
int ret = 0;
if (!is_directory(value)) {
gf_asprintf(op_errstr, "Failed: %s is not a directory", value);
ret = -1;
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, "%s",
*op_errstr);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 48614b0e00..fb9bf7ad4b 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -141,12 +141,11 @@ int
glusterd_uuid_init()
{
int ret = -1;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
glusterd_conf_t *priv = NULL;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
+ GF_ASSERT(priv);
ret = glusterd_retrieve_uuid();
if (ret == 0) {
@@ -171,10 +170,8 @@ glusterd_uuid_generate_save()
{
int ret = -1;
glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
- GF_ASSERT(this);
priv = this->private;
GF_ASSERT(priv);
@@ -238,13 +235,11 @@ glusterd_client_statedump_submit_req(char *volname, char *target_ip, char *pid)
char *end_ptr = NULL;
rpc_transport_t *trans = NULL;
char *ip_addr = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
char tmp[UNIX_PATH_MAX] = {
0,
};
- this = THIS;
- GF_ASSERT(this);
conf = this->private;
GF_ASSERT(conf);
@@ -450,8 +445,6 @@ glusterd_rpcsvc_options_build(dict_t *options)
{
int ret = 0;
uint32_t backlog = 0;
- xlator_t *this = THIS;
- GF_ASSERT(this);
ret = dict_get_uint32(options, "transport.listen-backlog", &backlog);
@@ -459,7 +452,7 @@ glusterd_rpcsvc_options_build(dict_t *options)
backlog = GLUSTERFS_SOCKET_LISTEN_BACKLOG;
ret = dict_set_uint32(options, "transport.listen-backlog", backlog);
if (ret) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
"Key=transport.listen-backlog", NULL);
goto out;
}
@@ -1066,8 +1059,6 @@ _install_mount_spec(dict_t *opts, char *key, data_t *value, void *data)
int rv = 0;
gf_mount_spec_t *mspec = NULL;
char *user = NULL;
- xlator_t *this = THIS;
- GF_ASSERT(this);
label = strtail(key, "mountbroker.");
@@ -1083,7 +1074,7 @@ _install_mount_spec(dict_t *opts, char *key, data_t *value, void *data)
mspec = GF_CALLOC(1, sizeof(*mspec), gf_gld_mt_mount_spec);
if (!mspec) {
- gf_smsg(this->name, GF_LOG_ERROR, errno, GD_MSG_NO_MEMORY, NULL);
+ gf_smsg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_NO_MEMORY, NULL);
goto err;
}
mspec->label = label;