summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
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/cluster
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/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c6
-rw-r--r--xlators/cluster/dht/src/dht-common.c1
-rw-r--r--xlators/cluster/ec/src/ec-helpers.c1
3 files changed, 4 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index a1aad6315ac..be5dd327c9d 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -851,10 +851,11 @@ afr_mark_active_sinks (xlator_t *this, unsigned char *sources,
priv = this->private;
- memset (sinks, 0, sizeof (*sinks) * priv->child_count);
for (i = 0; i < priv->child_count; i++) {
if (!sources[i] && locked_on[i])
sinks[i] = 1;
+ else
+ sinks[i] = 0;
}
}
@@ -1610,10 +1611,11 @@ afr_selfheal_find_direction (call_frame_t *frame, xlator_t *this,
}
/* Short list all non-accused as sources */
- memset (sources, 0, priv->child_count);
for (i = 0; i < priv->child_count; i++) {
if (!accused[i] && locked_on[i])
sources[i] = 1;
+ else
+ sources[i] = 0;
}
/* Everyone accused by non-self-accused sources are sinks */
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 9ae80b33fe3..d5b41eb9b3b 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1255,7 +1255,6 @@ dht_dict_get_array (dict_t *dict, char *key, int32_t value[], int32_t size, int
return -EINVAL;
}
- memset (value, 0, size * sizeof(int32_t));
for (vindex = 0; vindex < size; vindex++) {
value[vindex] = ntoh32(*((int32_t *)ptr + vindex));
if (value[vindex] < 0)
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c
index 9b833a8d3a4..ff3558def86 100644
--- a/xlators/cluster/ec/src/ec-helpers.c
+++ b/xlators/cluster/ec/src/ec-helpers.c
@@ -232,7 +232,6 @@ ec_dict_get_array (dict_t *dict, char *key, uint64_t value[], int32_t size)
return -EINVAL;
}
- memset (value, 0, size * sizeof(uint64_t));
/* 3.6 version ec would have stored version in 64 bit. In that case treat
* metadata versions same as data*/
old_size = min (size, len/sizeof(uint64_t));