summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
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/storage/posix
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/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-gfid-path.c2
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c6
2 files changed, 0 insertions, 8 deletions
diff --git a/xlators/storage/posix/src/posix-gfid-path.c b/xlators/storage/posix/src/posix-gfid-path.c
index 9873e7e5a84..686276eb5a9 100644
--- a/xlators/storage/posix/src/posix-gfid-path.c
+++ b/xlators/storage/posix/src/posix-gfid-path.c
@@ -145,7 +145,6 @@ posix_get_gfid2path (xlator_t *this, inode_t *inode, const char *real_path,
found = _gf_true;
} else {
have_val = _gf_false;
- memset (value_buf, '\0', sizeof(value_buf));
size = sys_llistxattr (real_path, value_buf,
sizeof (value_buf) - 1);
if (size > 0) {
@@ -205,7 +204,6 @@ posix_get_gfid2path (xlator_t *this, inode_t *inode, const char *real_path,
}
found = _gf_true;
- memset (value_buf, '\0', sizeof(value_buf));
size = sys_lgetxattr (real_path, keybuffer, value_buf,
sizeof (value_buf) - 1);
if (size == -1) {
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 1d15801b183..795f19a1515 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -3184,7 +3184,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
}
}
#endif
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
size = sys_lgetxattr (real_path, key, value_buf,
XATTR_VAL_BUF_SIZE-1);
if (size >= 0) {
@@ -3259,7 +3258,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
}
have_val = _gf_false;
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
size = sys_llistxattr (real_path, value_buf, XATTR_VAL_BUF_SIZE-1);
if (size > 0) {
have_val = _gf_true;
@@ -3326,7 +3324,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto ignore;
}
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
have_val = _gf_false;
size = sys_lgetxattr (real_path, keybuffer, value_buf,
XATTR_VAL_BUF_SIZE-1);
@@ -3494,7 +3491,6 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
allocate a new buffer value of required size and call getxattr again
*/
value_buf = alloca (XATTR_VAL_BUF_SIZE);
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
if (name) {
strncpy (key, name, sizeof(key));
@@ -3570,7 +3566,6 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
goto done;
}
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
size = sys_flistxattr (_fd, value_buf, XATTR_VAL_BUF_SIZE-1);
if (size > 0) {
have_val = _gf_true;
@@ -3619,7 +3614,6 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
break;
strncpy (key, list + list_offset, sizeof(key));
- memset (value_buf, '\0', XATTR_VAL_BUF_SIZE);
have_val = _gf_false;
size = sys_fgetxattr (_fd, key, value_buf,
XATTR_VAL_BUF_SIZE-1);