summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-08-24 20:59:30 +0300
committerAmar Tumballi <amarts@redhat.com>2018-08-29 17:31:11 +0000
commitcbe133c832fd9907619a1231aa3d9dda1330ae74 (patch)
treede607cd6daf2e22051da74c848fa569d68131f86 /xlators/mgmt
parent789a5a3d3cbad9c594fd2a94924ec0a2040c27ad (diff)
multiple files: remove unndeeded memset()
This is a squash of multiple commits: contrib/fuse-lib/misc.c: remove unneeded memset() All flock variables are properly set, no need to memset it. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I8e0512c5a88daadb0e587f545fdb9b32ca8858a2 libglusterfs/src/{client_t|fd|inode|stack}.c: remove some memset() I don't think there's a need for any of them. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I2be9ccc3a5cb5da51a92af73488cdabd1c527f59 libglusterfs/src/xlator.c: remove unneeded memset() All xl->mem_acct members are properly set, no need to memset it. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I7f264cd47e7a06255a3f3943c583de77ae8e3147 xlators/cluster/afr/src/afr-self-heal-common.c: remove unneeded memset() Since we are going over the whole array anyway, initialize it properly, to either 1 or 0. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Ied4210388976b6a7a2e91cc3de334534d6fef201 xlators/cluster/dht/src/dht-common.c: remove unneeded memset() Since we are going over the whole array anyway it is initialized properly. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Idc436d2bd0563b6582908d7cbebf9dbc66a42c9a xlators/cluster/ec/src/ec-helpers.c: remove unneeded memset() Since we are going over the whole array anyway it is initialized properly. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I81bf971f7fcecb4599e807d37f426f55711978fa xlators/mgmt/glusterd/src/glusterd-volgen.c: remove some memset() I don't think there's a need for any of them. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I476ea59ba53546b5153c269692cd5383da81ce2d xlators/mgmt/glusterd/src/glusterd-geo-rep.c: read() in 4K blocks The current 1K seems small. 4K is usually better (in Linux). Also remove a memset() that I don't think is needed between reads. Only compile-tested! Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I5fb7950c92d282948376db14919ad12e589eac2b xlators/storage/posix/src/posix-{gfid-path|inode-fd-ops}.c: remove memset() before sys_*xattr() functions. I don't see a reason to memset the array sent to the functions sys_llistxattr(), sys_lgetxattr(), sys_lgetxattr(), sys_flistxattr(), sys_fgetxattr(). (Note: it's unclear to me why we are calling sys_*txattr() functions with XATTR_VAL_BUF_SIZE-1 size instead of XATTR_VAL_BUF_SIZE ). Only compile-tested! Change-Id: Ief2103b56ba6c71e40ed343a93684eef6b771346 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c2
2 files changed, 5 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 7083fb1d339..ac07eb83bd8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -3848,7 +3848,7 @@ gd_pause_or_resume_gsync (dict_t *dict, char *master, char *slave,
pid_t pid = 0;
char pidfile[PATH_MAX] = {0,};
char errmsg[PATH_MAX] = "";
- char buf [1024] = {0,};
+ char buf [4096] = {0,};
gf_boolean_t is_template_in_use = _gf_false;
char monitor_status[NAME_MAX] = {0,};
char *statefile = NULL;
@@ -3903,7 +3903,7 @@ gd_pause_or_resume_gsync (dict_t *dict, char *master, char *slave,
goto out;
}
- ret = sys_read (pfd, buf, 1024);
+ ret = sys_read (pfd, buf, sizeof (buf));
if (ret > 0) {
pid = strtol (buf, NULL, 10);
if (is_pause) {
@@ -4006,7 +4006,7 @@ stop_gsync (char *master, char *slave, char **msg,
pid_t pid = 0;
char pidfile[PATH_MAX] = {0,};
char errmsg[PATH_MAX] = "";
- char buf[1024] = {0,};
+ char buf[4096] = {0,};
int i = 0;
gf_boolean_t is_template_in_use = _gf_false;
xlator_t *this = NULL;
@@ -4039,7 +4039,7 @@ stop_gsync (char *master, char *slave, char **msg,
if (pfd < 0)
goto out;
- ret = sys_read (pfd, buf, 1024);
+ ret = sys_read (pfd, buf, sizeof (buf));
if (ret > 0) {
pid = strtol (buf, NULL, 10);
ret = kill (-pid, SIGTERM);
@@ -5345,7 +5345,7 @@ glusterd_op_copy_file (dict_t *dict, char **op_errstr)
char *host_uuid = NULL;
char uuid_str [64] = {0};
char *contents = NULL;
- char buf[1024] = "";
+ char buf[4096] = "";
int ret = -1;
int fd = -1;
int bytes_writen = 0;
@@ -5436,7 +5436,6 @@ glusterd_op_copy_file (dict_t *dict, char **op_errstr)
if (ret > 0) {
memcpy (contents+bytes_read, buf, ret);
bytes_read += ret;
- memset (buf, '\0', sizeof(buf));
}
} while (ret > 0);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 614ce0eab23..35e49bf56fc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -6121,7 +6121,6 @@ generate_dummy_client_volfiles (glusterd_volinfo_t *volinfo)
if (!dict)
goto out;
for (i = 0; types[i]; i++) {
- memset (filepath, 0, sizeof (filepath));
ret = dict_set_str (dict, "client-transport-type", types[i]);
if (ret)
goto out;
@@ -6195,7 +6194,6 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo,
if (!dict)
goto out;
for (i = 0; types[i]; i++) {
- memset (filepath, 0, sizeof (filepath));
ret = dict_set_str (dict, "client-transport-type", types[i]);
if (ret)
goto out;